RE: [PHP] Multiple pages including one Class...

From: Date: Tue, 28 Nov 2000 19:49:33 +0000
Subject: RE: [PHP] Multiple pages including one Class...
Groups: php.general 
Request: Send a blank email to php-general+get-27665@lists.php.net to get a copy of this message
> 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

« previous php.general (#27665) next »