The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
using PHP in templates?
I'm starting to integrate the forum into my site, in the HEADER template i added the code for my navigation which is betwen <?php ?> tags, it just shows the code on the actual forum page
i have tried removing the tags incase it was already a php template but it didnt work either, any ideas? |
#2
|
|||
|
|||
Quote:
What I would do is search for the php file that calls that template (I think it's global.php). Put your php in that file before it calls the template, assign the output to a variable and then put that variable in the place you want it to show in the template. |
#3
|
|||
|
|||
No need to edit PHP files. You can place PHP in a Plugin (AdminCP > Plugins & Products > Add New Plugin). Assign any output to a specific variable and use that variable in the template.
|
#4
|
|||
|
|||
Duh, spaced on the plugin system for some reason
|
#5
|
|||
|
|||
thanks..
what would hook location be if i want it in the HEADER template. and what would the hook be? it doesnt seem to have field to set it |
#6
|
|||
|
|||
Hook location: global_start or global_setup_complete
|
#7
|
|||
|
|||
and then i would put $global_start
where i wanted it to appear???. sorry, new to this |
#8
|
|||
|
|||
Quote:
PHP Code:
|
#9
|
|||
|
|||
hmm its not working for me. nothing appears
i chose global_start for hook location,execution order: 5 i put the variable $alnav in my template where i wanted it to appear this is sort of the code i am using: any ideas? PHP Code:
|
#10
|
|||
|
|||
Quote:
Code:
unset($alnav); if (empty($p)) { $alnav .= "<li><a href=\"../?p=home\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('home','','../images/nav/nav_home_h.gif',1)\"> <img src=\"../images/nav/nav_home_a.gif\" id=\"home\" /></a></li>"; } else { if ($p == 'home') { $alnav .= "<li><a href=\"../?p=home\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('home','','../images/nav/nav_home_h.gif',1)\"> <img src=\"../images/nav/nav_home_a.gif\" id=\"\home\" /></a></li>"; } else { $alnav .= "<li><a href=\"../?p=home\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('home','','../images/nav/nav_home_h.gif',1)\"> <img src=\"../images/nav/nav_home_l.gif\" id=\"\home\" /></a></li>"; } } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|