On Thu, 05 Jun 2003 16:41:01 -0400, Tom Ray [Lists] wrote: >First, I would drop a .htaccess file that allows the HTML files to run >through the PHP parser. Like this AddType application/x-httpd-php .php .html > >-h1-<? include('header.inc'); ?>-/h1-
Yeah, that would work but my goal was to not have to modify the html files at all. Actually, I figured it out (or at least have it working). I guess I knew it was possible, but I was hoping for a miracle cure like "add_html_header". :) Anyway, here is what I ended up doing... .htaccess AddType application/x-httpd-php .htm .html php_value auto_prepend_file "header.php" php_value auto_append_file "footer.php" header.php <?PHP ob_start(); ?> footer.php <?PHP $content = ob_get_contents(); ob_end_clean(); $header = "\n<h1>This is a page header</h1>"; $footer = "<h3>This is the footer</h3>\n"; $content = preg_replace( "/(<body[^>]*>)/i", "$1$header", $content ); $content = preg_replace( "/(<\/body[^>]*>)/i", "$footer$1", $content ); echo $content; ?> Any other ideas or simpler ways to do it would be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php