The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Im trying to include an external php file in the VB template. I found this tutorial. I've added the following plugin with Global_Start as the Hook Location.
Plugins are Enabled in VB Options and the plugin itself is activated too. Code:
ob_start(); include('/home/.../bh_includes/head_common.php');
$includedheader = ob_get_contents();
ob_end_clean();
Nothing is showing up in my template though. |
|
#2
|
|||
|
|||
|
You need to add this:
PHP Code:
|
|
#3
|
||||
|
||||
|
Thanks
Where would i include that? |
|
#4
|
||||
|
||||
|
<a href="https://vborg.vbsupport.ru/showthread.php?t=242454" target="_blank">[vBulletin 4] Simple way of including an external PHP file</a>
|
|
#5
|
|||
|
|||
|
At the end, as in the article Lynne linked to. And sorry, BTW, what I posted actually had an error in it.
|
|
#6
|
||||
|
||||
|
So this is what i have right now:
Code:
ob_start(); include('/home/XXXX/public_html/bh_includes/head_common.php');
$includedphp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('header', array('includedheader' => $includedheader));
Its still not working |
|
#7
|
|||
|
|||
|
Sorry, I probably confused you with my error. This should work:
PHP Code:
with this in the header template: {vb:raw includedheader} (the variable names needed to match in the ob_get_contents() and preRegister lines). |
|
#8
|
|||
|
|||
|
I have a very similar question. My site is www.wavingthewheat.com
I am using a php script to count the number of rows in a table on the database. The script is loaded at www.wavingthewheat.com/chatuser.php I am trying to have the output of that file displayed in my navbar template. I have created a plugin with the following code PHP Code:
The php script works and displays the number of online users, however I can't get anything to display in the template using the plugin. |
| Благодарность от: | ||
| nima6 | ||
|
#10
|
||||
|
||||
|
Quote:
That worked. Thanks a bunch. --------------- Added [DATE]1314819916[/DATE] at [TIME]1314819916[/TIME] --------------- I must the most idiot on this forums. I'm trying to include a second php file (for footer this time) and am having problems again. This time this is what im using: Code:
ob_start();
include('/home/XXXX/public_html/bh_includes/footer-common.php');
$includedfphp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('footer', array('includedfooter' => $includedfphp));
That doesnt work either. I changed the includedphp to includedfphp because using just the includedphp didnt work. I assumed it was because that variable was already being used elsewhere so i changed it (nothing happened though) |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|