![]() |
SIMPLE question?? assigning variables to a template
I have a variable in global.php
<?php ... $myvar = 'some stuff'; .. ?> What do I need to do to make this variable accessable from a template? |
Nothing, just add it where you want.
|
Well, I tried. But was unsuccessful.
What I did was.. First, add my variable ($myvar) to global.php. Second, edit the "header" template from the admin control panel by adding [$myvar] did not work. When I refresh the page I get [ ] instead of [some stuff] |
Try using just: $myvar
|
Where exactly in global.php did you put it ?
|
Quote:
I tried putting it at the beginning and it shows up in the template. I guess I'm not understanding in which order things are processed. |
That's why I asked - the header is processed about 2/3rds of the way down global.php.
BTW, you shouldn't edit the file, but use a plugin - and the global_start hook. :) Edit - Actually, the parse_templates hook is called just before the header template is processed, so you probably could use that. |
global_start would be the more correct plugin to use.
|
Thanks Paul and everybody who replied. I will look into the plugin system.
|
All times are GMT. The time now is 05:29 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|