Re: overriding auto_prepend_file
| From: | Dave Seidel | Date: | Thu, 31 Aug 2000 03:21:23 +0000 |
| Subject: | Re: overriding auto_prepend_file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14503@lists.php.net to get a copy of this message | ||
Good points, and I actually have a structure similar in some ways to what
you propose. But this is not a production environment, it's a standalone
development machine, and I need to be able to do things like learn PHPLIB is
one area while I do other things in other areas. Eventually, it will all be
integrated. The other point is, I like to have a complete understanding of
how to control configuration -- the more I know, the more effective I can
be.
-- Dave
----- Original Message -----
From: "Nold, Mark" <Mark.Nold@normandy.com.au>
To: "Php-General (E-mail)" <php-general@lists.php.net>
Cc: <dave@superluminal.com>
Sent: Wednesday, August 30, 2000 9:12 PM
Subject: Re: [PHP] overriding auto_prepend_file
> --------------------------------------------------------------------------
--
> -----------------
> 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.
>