Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 04-13-2005, 03:04 AM
gnawph gnawph is offline
 
Join Date: Oct 2004
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I access a new variable within a template?

I've used this tutorial to make a simple page. The goal is to create a movie viewer. I need to have access to a new variable inside of a template file so I can use conditionals on my new variable to make something happen.

For example here is my ideal template:
HTML Code:
<div>
     <if condition="$my_new_variable">Do this</if>
</div>
Reply With Quote
  #2  
Old 04-13-2005, 03:08 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's correct, you may want to add a value to it, such as
HTML Code:
 <if condition="$my_new_variable == 1">.
What is the problem? You will need to define the variable in your PHP file first.
PHP Code:
$my_new_variable 1
Reply With Quote
  #3  
Old 04-16-2005, 03:45 AM
gnawph gnawph is offline
 
Join Date: Oct 2004
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks

I'm not really sure why my variable wouldn't work before. All kosher now, thanks!
Reply With Quote
  #4  
Old 03-12-2009, 11:41 AM
Illthis Illthis is offline
 
Join Date: Feb 2009
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have the same Problem:

I want to use a variable
$tight_editor
in my
editor_toolbar_on template

which i declared in my profile.php on the first hook which is called profile_start

unfortunately in my editor i can't echo the variable

any ideas
Reply With Quote
  #5  
Old 05-11-2009, 06:29 AM
solita_ugc solita_ugc is offline
 
Join Date: Feb 2009
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SirAdrian View Post
That's correct, you may want to add a value to it, such as
HTML Code:
 <if condition="$my_new_variable == 1">.
What is the problem? You will need to define the variable in your PHP file first.
PHP Code:
$my_new_variable 1
Should the variable be defined global?
Reply With Quote
  #6  
Old 05-27-2009, 12:22 AM
warrentr2 warrentr2 is offline
 
Join Date: May 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,
I battled with a similar issue for quite some time and noticed the following:
Lets say I want to display a debug variable in the header template like:
HTML Code:
<div>$debugMsg</div>
That var must be set BEFORE global_setup_complete. For example, if I make the var
PHP Code:
$debugMsg "Test Message"
in the global_setup_complete hook, the header template will never display anything. However, if I move the above php to global_start, it works as intended.

This is great if you want your code to be in global_start, but what if you need it later? Does anyone know a simple way to change the already processed templates?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:58 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04285 seconds
  • Memory Usage 2,212KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_html
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete