PDA

View Full Version : Problems applying my template to vB


mox-
11-21-2005, 12:20 PM
Here is my problem.

I have a "template manager" that I made in PHP


<?php
setlocale(LC_ALL, 'fr_CA');

$fn = "/usr/local/www/data/www.quebecphotos.ca/template.html";

$tfile = fopen($fn, "r");
$template = fread($tfile,filesize($fn));
fclose($tfile);

$template = preg_replace("/\[\[DATE\]\]/",strftime("%d %B %Y"),$template);

list($qphotos_header, $qphotos_footer) = split ('\[\[CONTENU\]\]', $template);

?>


It's reading this template: http://www.quebecphotos.ca/template.html

In the index.php it's working well

<?php
include "template.php";
echo $qphotos_header;
?>
Here is the content !
<?php
echo $qphotos_footer;
?>


Now.. for vBulletin

I added to the global.php file the following
(Just between the "Start initialisation" and "turn off popups if they are not available to this browser")

ob_start();
include('/usr/local/ww/data/www.quebecphotos.ca/template.php');
$qphotos_header = ob_get_contents();
ob_end_clean();

ob_start();
include('/usr/local/ww/data/www.quebecphotos.ca/template.php');
$qphotos_footer = ob_get_contents();
ob_end_clean();


I don't know why.. but the $qphotos_footer is empty

$qphotos_header is working fine

You can see that on http://www.quebecphotos.ca/forum/ There is no custom footer

I made the changes to the header/footer templates by adding this at the appropriate places.. and when viewing the source we can see the <!-- .. --> tags but not the footer..

<!--// QPHOTOS HEADER //-->
$qphotos_header
<!--// /QPHOTOS HEADER //-->

[...]

<!--// QPHOTOS FOOTER //-->
$qphotos_footer
<!--// /QPHOTOS FOOTER //-->



Is there anything that I am doing wrong ?

My guess is that I'm doing something wrong in the global.php file because I'm not sure if I well understood how to add 'plugins'

mox-
11-28-2005, 03:09 AM
bump!

Marco van Herwaarden
11-28-2005, 06:49 AM
Try moving that code from global.php to a plugin at the 'global_start' hook location.

mox-
11-30-2005, 10:32 PM
Try moving that code from global.php to a plugin at the 'global_start' hook location.

I'm not sure if I understand that very well.. hehe