I'm using FastTemplate, and was thinking about the best ways to impliment it while having a minimum amount of duplicate code in my pages. What I'm trying to do is prepend a file in every page, which starts output buffering and registers a shutdown function to process the page and use the template, like this:
<?php
ob_start();
register_shutdown_function('send');
?>
The problem I'm running into is that the buffered output seems to be sent before the shutdown function send() is called. So I end up with the page content printed first, and then my template below it with no content.
This seems like a long shot, but is there any way to make the shutdown function be called while the output is still being buffered? Or, is there an alternative to register_shutdown_function which would call send() at the right moment?
How have others approached this problem?
Thanks,
Keegan
P.S. I've tried using the parameter to ob_start as documented, but it seems to be ignored in 4.0.3. I installed 4.0.4 on my home computer and got it working that way, but the server that this site will be on is running an earlier version of PHP4 which doesn't seem to support the parameter to ob_start.