The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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? |
#2
|
||||
|
||||
You're correct you simply put $variable wherever you want to see the number 1
|
#3
|
||||
|
||||
It doesn't work, unfortunately.
My plugin literally is under global_start: Code:
$variable = 1; HTML Code:
Variable = $variable. |
#4
|
||||
|
||||
Nope, in your template just put $variable
or you can use it like this <td>$variable2345</td> which will give you 12345 |
#5
|
||||
|
||||
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.
|
#6
|
|||
|
|||
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'].
|
#7
|
||||
|
||||
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 |
#8
|
||||
|
||||
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.
|
#9
|
|||
|
|||
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. |
#10
|
||||
|
||||
Awesome. Thank you. I see what I'm not doing correctly. I just had to change the hook location. Appreciate the help, kh99.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|