views:

37

answers:

1

I want to include a certain file with every page-call.

For simplicity, assume I have a header which should be pre-pended to every file.
(Eg. a php script which checks all sorts of user agent stuff.)

I could use mod_rewrite to send all requests to this file, and then use PHP to include the requested page into the file, but that could be a headache with paths and whatnot, and I would rather not use mod_rewrite if not needed.

I recall there being a 'include' call in htaccess, but the only thing I can find in a search is ServerSideIncludes - which is not what I need. SSI (I gather) scans the document looking for a call, whereas I need to include this file before going onto the file being called.

+1  A: 

Aside from SSI's there's also a PHP-specific option for including header/footer file with every PHP page so this solution may be too limit for you:

In .htaccess:

php_value auto_prepend_file /www/root/header.php
php_value auto_append_file /www/root/footer.php
pygorex1
At least its a solution, though I do need this for html files as well.
SamGoody