Re: Multiple pages including one Class...

From: Date: Wed, 29 Nov 2000 09:23:56 +0000
Subject: Re: Multiple pages including one Class...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27684@lists.php.net to get a copy of this message
Very true and I agree, it is just that by adding the one GLOBAL line then all the code, no matter if it is written cleanly, would work fine. The other option is to double check that the included file is not included in a function anywhere. Doing the GLOBAL is only a quick fix. Jay ----- Original Message ----- From: "Boget, Chris" <Chris.Boget@wild.net> To: "'Jason Lavigne'" <jlavigne@stonecroft.net> Cc: <php-general@lists.php.net>; <roy@vem.ca> Sent: Tuesday, November 28, 2000 3:02 PM Subject: RE: [PHP] Multiple pages including one Class... > > And if you do this: > > GLOBAL $ThisLibraryDefined; > > if( !$ThisLibraryDefined ) { > > $ThisLibraryDefined = 1; > > } > > then it would also work if the include was called from within > > a function. > > But only then. PHP doesn't like you using the GLOBAL keyword > outside of a function. If you do, PHP will hack, spit and die. > > Generally, I don't "Include" or "Require" inside of a function. There > is no reason to, IMO. If a function in one file is going to need a > function in another, just include the second at the top of the code of > the first. Again, IMO. > > Chris >

« previous php.general (#27684) next »