The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Including output of PHP file in custom template? [closed]
Hi Guys,
I've read plenty of threads on how to insert PHP code in a custom vBulletin page. However, I'm trying to insert the output of a PHP file inside a custom template. This custom template is itself inside the header template. What I've got right now is a custom template which creates a place-holder inside the header. The header template just has the following added: Code:
{vb:raw showCustomTemplate} Code:
{vb:raw myPHPFileOutput} Any help appreciated. Edit: Let's assume the php file is: <?php echo("hello world"); ?> --------------- Added [DATE]1262281885[/DATE] at [TIME]1262281885[/TIME] --------------- I've added a new plugin which helps me somewhat but not entirely: Code:
ob_start(); include 'myPHPFile.php'; $include_contents = ob_get_contents(); ob_end_flush(); vB_Template::preRegister('myCustomTemplate',array('php_file_output' => $include_contents)); 1. Inside the header place-holder, which is correct 2. Right at the top of the page, which is wrong. I have a feeling this isn't the correct approach. --------------- Added [DATE]1262282717[/DATE] at [TIME]1262282717[/TIME] --------------- I've changed the new plugin code from ob_end_flush() to ob_end_clean(). This has got rid of the output appearing right at the top of the page (#2) however, I've got these strange characters before the output of my php file. The place-holder in the header now reads: hello world --------------- Added [DATE]1262284458[/DATE] at [TIME]1262284458[/TIME] --------------- Right so those strange characters represent the Byte Order Mark (BOM). I got rid of those by converting my php file to save without the BOM. I really don't see why this should solve the problem since I'm only including what's being output by the PHP file; nevertheless, it does work. It seems all my problems are solved. Consider this thread closed |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|