note 36965 deleted from function.ob-start by sniper

From: Date: Mon, 03 Nov 2003 15:36:04 +0000
Subject: note 36965 deleted from function.ob-start by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59686@lists.php.net to get a copy of this message
Note Submitter: oliver.no.spam.story@anu.edu.au ---- I have a draft server and live server, and wanted to add a big red marker so that my colleagues approving draft pages knew which was which. My solution: an auto-prepended file on my draft server (set in apache configuration) with the following code: <?php function mark_as_draft($page) { $heading = '<h1 style="color: #D00; text-align: center">DRAFT</h1>'; $page = ereg_replace('(<body[^>]*>)', '\\1'.$heading, $page); return $page; } ob_start('mark_as_draft'); ?> The ereg_replace() is there because I was having browser rendering problems when I initially tried outputing the <h1> at the start of the file (ie making the html invalid). The appropriate apache directive is: php_value auto_prepend_file /path/to/prepend_file.php

« previous php.notes (#59686) next »