The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]() PHP Code:
How would I go about calling my custom template from this function? |
#2
|
|||
|
|||
![]()
<a href="https://vborg.vbsupport.ru/showthread.php?t=119933&highlight=fetch+custom+tem plate" target="_blank">https://vborg.vbsupport.ru/showt...ustom+template</a>
That should help. |
#3
|
|||
|
|||
![]() Quote:
Something else of note: if I take the code out of the function and call it inline, the custom template works fine. Maybe that helps... |
#4
|
|||
|
|||
![]()
Turns out that 'myheader' worked in the function. The problem was that 'myheader' contains references to vB's default header template (as '$header'), and that wasn't working within the function. To get around this, I have to manually call eval('$header = "' . fetch_template('header') . '";'); within the function.
This brings me to my new question: I have some plugin code in the global_start hook that works fine, unless I call it from within a function. How would I go about doing this? |
#5
|
|||
|
|||
![]()
If you want to access variable define outside a function you need to use the global keyword to enable it to work inside the function. For example:
PHP Code:
|
#6
|
||||
|
||||
![]()
No need for the colon (does it even work that way?), it should be simply:
PHP Code:
|
#7
|
|||
|
|||
![]()
Oops my bad. Wasn't concentrating.
![]() |
#8
|
|||
|
|||
![]()
Thanks! A new challenge, though...
I'm now trying to fetch $myheader through a parse_templates plugin, so I no longer have to include that line in my function: PHP Code:
|
#9
|
||||
|
||||
![]()
Use var_dump and dump the variable to see if it exists.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|