Go wild Arpi!


Maxim Maletsky

 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)

 www.PHPBeginner.com
 [EMAIL PROTECTED]




> -----Original Message-----
> From: Arpad Tamas [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 10:34 AM
> To: Miguel Cruz
> Cc: Maxim Maletsky; [EMAIL PROTECTED]
> 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to