Re: overriding auto_prepend_file

From: Date: Thu, 31 Aug 2000 01:12:30 +0000
Subject: Re: overriding auto_prepend_file
Groups: php.general 
Request: Send a blank email to php-general+get-14487@lists.php.net to get a copy of this message
---------------------------------------------------------------------------- ----------------- Disclaimer: The information contained in this email is intended only for the use of the person(s) to whom it is addressed and may be confidential or contain legally privileged information. If you are not the intended recipient you are hereby notified that any perusal, use, distribution, copying or disclosure is strictly prohibited. If you have received this email in error please immediately advise us by return email at postmaster@normandy.com.au and delete the email document without making a copy. ---------------------------------------------------------------------------- ----------------- I prefer not to turn the prepend on and off but have a very simple prepend that includes everything else... It also helps with controlling and sharing include files (set include root to / in your ini) I very simplified version may read if($HTTP_HOST == "blah.com"){ $include_root = "/www/include/blah"; }elseif($HTTP_HOST == "www.foo.com"){ $include_root = "/www/include/foo/production"; }elseif($HTTP_HOST == "test.foo.com"){ $include_root = "/www/include/foo/test"; }elseif($HTTP_HOST == "dev.foo.com"){ $include_root = "/www/include/development"; } include("$include_root/db-abstraction.inc"); include("$include_root/general-function.inc"); include("$include_root/display-function.inc"); include("$include_root/site-stuff.inc"); // This could be a list of site specific includes With this sort of structure my prepend does next to nothing but set up some functions etc. So it never needs to be turned off. Its also Cross server since Apache directives are not available on non Apache servers. Now you may have html logic embedded in your prepend and append to achieve a similiar frame work to the PHP site. If you do this it is bad practice as you cant send headers etc with having to turn that off. Realisitically nothing in a Prepended file should have an echo or print. If you need to do this have a set of functions like page_header() and page_footer() which you could call at the top and bottom of each page explicitly. If these functions are in display-function.inc you could move a file from one virtual host to the next (eg: from foo.com to blah.com) and it will pick up the required formating etc. Anyway i think if you relook at how you are doing things you may find a beter answer than turning the prepend on and off. mn Mark Nold markn@alverstone.com.au Systems Consultant Change is inevitable, except from vending machines.

« previous php.general (#14487) next »