RE: [PHP] Re: some kind of "library loader" - Thanks

From: Date: Thu, 04 Apr 2002 21:17:18 +0000
Subject: RE: [PHP] Re: some kind of "library loader" - Thanks
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-91600@lists.php.net to get a copy of this message
Go wild Arpi! Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com maxim@phpbeginner.com > -----Original Message----- > From: Arpad Tamas [mailto:sts@mail.xubion.hu] > Sent: Thursday, April 04, 2002 10:34 AM > To: Miguel Cruz > Cc: Maxim Maletsky; php-general@lists.php.net > Subject: Re: [PHP] Re: some kind of "library loader" - Thanks > > > Ok, Thank you for your help Miguel and Maxim, I'm trying to do it by > the help of your suggestions. > > Arpi > > > > >Also, you can find out if a class was defined by calling > > > >'class_exists()'. In this way you might save something. > > > >The best way thought is what Miguel was saying: load the files > > > >conditionally with a logic. > > > > > > That's what I'm trying to do, but still searching for the logic. > > > But as I see, there's no better way of doing this other than > > > checking if the needed classes are defined before every > > > instantiation. > > > > Perhaps you can conjure up some sort of namespace scheme, and then > > use a global array to track which class files have been loaded, or > > which classes have been instantiated, or whatever it is you need to > > keep track of. > > > > In your file with a dependency: > > > > global $LOAD_STATUS; > > if (!$LOAD_STATUS['classes-db-queryops']) > > include 'lib/classes/db/queryops.php'; > > > > In lib/classes/db/queryops.php: > > > > global $LOAD_STATUS; > > $LOAD_STATUS['class-db-queryops'] = 1; > > > > Seems fairly cheap to do. > > > > miguel

« previous php.general (#91600) next »