View Full Version : How can I access a new variable within a template?
gnawph
04-13-2005, 03:04 AM
I've used this tutorial (https://vborg.vbsupport.ru/showthread.php?t=62164) 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:
<div>
<if condition="$my_new_variable">Do this</if>
</div>
Adrian Schneider
04-13-2005, 03:08 AM
That's correct, you may want to add a value to it, such as
<if condition="$my_new_variable == 1">. What is the problem? You will need to define the variable in your PHP file first.
$my_new_variable = 1;
gnawph
04-16-2005, 03:45 AM
Thanks
I'm not really sure why my variable wouldn't work before. All kosher now, thanks!
Illthis
03-12-2009, 11:41 AM
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
solita_ugc
05-11-2009, 06:29 AM
That's correct, you may want to add a value to it, such as
<if condition="$my_new_variable == 1">. What is the problem? You will need to define the variable in your PHP file first.
$my_new_variable = 1;
Should the variable be defined global?
warrentr2
05-27-2009, 12:22 AM
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:
<div>$debugMsg</div>
That var must be set BEFORE global_setup_complete. For example, if I make the var
$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?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.