Re: Multiple pages including one Class...

From: Date: Wed, 29 Nov 2000 07:57:56 +0000
Subject: Re: Multiple pages including one Class...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27667@lists.php.net to get a copy of this message
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. Jay ----- Original Message ----- From: "Boget, Chris" <Chris.Boget@wild.net> To: "'Roy Nasser'" <roy@vem.ca>; "Php (E-mail)" <php-general@lists.php.net> Sent: Tuesday, November 28, 2000 2:49 PM Subject: RE: [PHP] Multiple pages including one Class... > > Hi Everyone, > > I am having a problem building a very complex site with many > > includes and > > classes... > > I am running into problems because Some pages try to include > > a file, and define a class which has already been defined... > > Is there a SURE way to make this type of error not happen? > > Around all the functions in each of my include file, I do the follwing: > > if( !$ThisLibraryDefined ) { > $ThisLibraryDefined = 1; > } > > Which makes my file look like this: > > if( !$ThisLibraryDefined ) { > $ThisLibraryDefined = 1; > > function thisFunction() { > } > > function thatFunction() { > } > > function theOtherFunction() { > } > } > > No matter how many files I include that include the above > file, it only defines the functions once. > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27667) next »