![]() |
Running Quick PHP in a Template Via Plugin
I'm trying to just make a very simple and quick variable that I'd like to place into a template. I made a plugin using global_start and just put something along the lines of:
Code:
$variable = 1; Am I missing something? |
You're correct you simply put $variable wherever you want to see the number 1 :)
|
It doesn't work, unfortunately.
My plugin literally is under global_start: Code:
$variable = 1; HTML Code:
Variable = $variable. |
Nope, in your template just put $variable
or you can use it like this <td>$variable2345</td> which will give you 12345 |
Right. But it doesn't work. I put $variable and it shows nothing. I pull up the source and it's like it's not even there.
|
Where are you using your template? Some templates are used inside a function, and then you can't use global variables directly. You could try using $GLOBALS['variable'].
|
I guess that makes sense.
I'm modifying 4 templates: forumhome_forumbit_level1_nopost forumhome_forumbit_level1_post forumhome_forumbit_level2_nopost forumhome_forumbit_level2_post |
I guess it would be best if you showed us EXACTLY what you are using, with what hook and where you are trying to use it in those templates.
|
Quote:
I think that's your problem - those are used in the function construct_forum_bit() (in includes/functions_forumlist.php), so your global variable isn't in scope. |
Awesome. Thank you. I see what I'm not doing correctly. I just had to change the hook location. Appreciate the help, kh99.
|
All times are GMT. The time now is 09:23 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:
|