The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Include php file in template
Hi everyone. I have some trouble including a php file in my template, will describe the problem below:
I have a template with an header, a navbar, the forum/content, footer and a fixed right bar. I want to insert this php code(for now) into the right bar: userbox.php PHP Code:
PHP Code:
PHP Code:
The HOOK is parse_templates. When i in the plugin write echo $userboxinsert; the userbox get's inserted but at the top of the screen, so the link works. Would be very happy if someone could help me with this problem! --------------- Added [DATE]1301321363[/DATE] at [TIME]1301321363[/TIME] --------------- I can add that when I turn debug on, the file is included but it doesn't write out any text! |
#2
|
||||
|
||||
This line here is registering a variable named $php_include:
PHP Code:
HTML Code:
{vb:raw php_include} PHP Code:
|
#3
|
|||
|
|||
Thank you that solved the problem!
|
#4
|
||||
|
||||
I am using (vBulletin 4.0.5 Patch Level 6)
Plugin Code: Code:
ob_start(); require_once('/home/XXXX/public_html/Web/Kellys_New_Menu.php'); $kbar = ob_get_contents(); ob_end_clean(); vB_Template::preRegister('header',array('kellysmenu' => $kellysmenu)); To display in header template I tried both below, but I still get no output Code:
$kellysmenu {vb:raw kellysmenu} |
#5
|
|||
|
|||
Change the preRegister line to:
Code:
vB_Template::preRegister('header',array('kellysmenu' => $kbar)); (or else change the ob_get_contents() line to use $kellysmenu instead of $kbar). |
#6
|
||||
|
||||
Code:
ob_start(); require_once('/home/XXXX/public_html/Web/Kellys_New_Menu.php'); $kellysmenu = ob_get_contents(); ob_end_clean(); vB_Template::preRegister('header',array('kellysmenu' => $kellysmenu)); To display in header template I tried both below, but I still get no output Code:
$kellysmenu |
#7
|
|||
|
|||
Try using hook parse_templates. If it still doesn't work, try this as a test:
Code:
ob_start(); //require_once('/home/XXXX/public_html/Web/Kellys_New_Menu.php'); $kellysmenu = "This is Kelly's Menu"; ob_end_clean(); vB_Template::preRegister('header',array('kellysmenu' => $kellysmenu)); BTW, you definitely want to use {vb:raw kellysmenu} in the template (assuming you have some version of vbulletin 4). |
#8
|
||||
|
||||
Thanks
{vb:raw kellysmenu} worked this morning |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|