Re: [PHP4BETA]: require strategies
| From: | Chuck Hagenbuch | Date: | Thu, 18 Nov 1999 02:31:51 +0000 |
| Subject: | Re: [PHP4BETA]: require strategies | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6417@lists.php.net to get a copy of this message | ||
Quoting Daniel Landau <daniel@cybersight.com>:
> It seems to me that require() should be responsible for tracking this kind
> of stuff, but it doesn't seem to be. Also, I though about writing a function
> to track repeated includes and not repeat, but including that function would
> subject to the same conundrum as above.
I include the following block at the top of my class files:
if (defined('MODULE_Preferences')) return;
define('MODULE_Preferences', 1);
(with the name changed appropriately, of course). Unfortunately it means
that you have to use include(), not require(), but it's the cleanest
solution I could come up with in a relatively short period of time.
-chuck
--
Charles Hagenbuch, <chagenbu@wso.williams.edu>
--
"hello, I'm a giant cheese, and I'm here to give you a therapeutic massage"