Re: Need help with auto_prepend_file

From: Date: Mon, 24 Sep 2001 14:40:55 +0000
Subject: Re: Need help with auto_prepend_file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68524@lists.php.net to get a copy of this message
<Original message> From: Michael Champagne <mchampagne@capis.com> Date: Mon, Sep 24, 2001 at 09:28:01AM -0500 Message-ID: <Pine.WNT.4.33.0109240923250.239-100000@wkstn114.capis.com> Subject: [PHP] Need help with auto_prepend_file > Our website relies heavily on include files. We have a single include file > that is 'auto prepended' to every php file on the site using the > auto_prepend_file directive in php.ini. This include file does an > include_once on other include files. Also, most parts of our code include > other page components such as our menu bar from other .inc files. > > Should we be using auto_prepend_file? It seems like this does not do an > include_once and when we turn error_reporting = E_ALL we are seeing a lot of > errors on variables that have already been defined and such. > > Thanks in advance for any replies. > > Mike </Original message> <Reply> What you can do is check on some constant that you define the first time the file is included. The auto prepended file will then look something like: --- Pseudo code --- - if constant A is not defined -- define constant A -- your code --- End of Pseudo code --- This will make sure function, variables and/or constants will only be defined once. </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#68524) next »