If every page requires common code to be included, for example a common header and footer then rather than include 'header.php' and/or include 'footer.php' on evry page you can make uses of PHP's auto_prepend_file and auto_append_file.
These directives can be set either in http.conf (inside a vhost) or in a .htaccess file.
Example:
Code: Select all
php_value auto_prepend_file prepend.php
Inside prepend.php you could initialise objects, such a logging objects, check user permissions for the requested page and also do your include 'header.php' too. auto_append_file is the same but it is 'called' after you script. So the flow goes..
auto_prepend_file first.
you script next.
auto_append_file last.