note 54976 deleted from function.register-shutdown-function by jacques
| From: | jacques@php.net | Date: | Thu, 21 Jul 2005 12:59:10 +0000 |
| Subject: | note 54976 deleted from function.register-shutdown-function by jacques | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92256@lists.php.net to get a copy of this message | ||
Note Submitter: soywiz at gmail dot com
----
You can use register_shutdown_function to add a footer in certain conditions. ex.:
-----
includes/load_header_footer.php
-----
<?php
require(dirname(__FILE__) . '/header.php');
function html_append() { require(dirname(__FILE__) . '/footer.php'); }
register_shutdown_function('html_append');
?>
-----
anyfile.php
-----
<?php
require(dirname(__FILE__) . '/includes/load_header_footer.php');
// Do anything. You do not have to include footer since it will append automatically at end.
?>
This way you can avoid append footer includes.
NOTE: using ob_start for whole html: ex. ob_start("ob_gzhandler"); al beginning, will not
work since PHP close all buffers before call shutdown callback functions.