Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001092

Re: [PHP] Need help with auto_prepend_file From: * R&zE: (renze <email protected>)
Date: 09/24/01

<Original message>
From: Michael Champagne <mchampagne <email protected>>
Date: Mon, Sep 24, 2001 at 09:28:01AM -0500
Message-ID: <Pine.WNT.4.33.0109240923250.239-100000 <email protected>>
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 <email protected> -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>