Re: OOP problems with require/include

From: Date: Wed, 08 Nov 2000 15:19:28 +0000
Subject: Re: OOP problems with require/include
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24323@lists.php.net to get a copy of this message
Could you send some sample code? (Perhaps offlist instead). I think this may be a sloppiness issues on your part, or at least unfamiliarity. We have a DB class as well that's included, but there's no need for nesting it. Perhaps you're including it in other classes? That may not be the best way to go about it. require that db class on every page/file, so that it's always there. Create an instance ($db = new DB(); for example), then pass that instance to your other class functions. Would that work for you? It's how we do it. If that doesn't work, let me know - send some code so we can look it over. Ivan Quintero wrote: > I have designed a class that handles all the SQL queries. I use this class > to create objects throughout my scripts. > > However, I have other clases that rely on this class to work. Therefore, I > "require" the code for the class and instantiate the object to use it. But > there is a catch, PHP won't let you have nested Class declarations. > > Also, when I write a script that has this SQL class in it, but then > intantiate an object that itself uses this class I get an error saying that > I cannot redeclare a class. > > How do you experienced PHP programmers get around these limitations. Or am I > just a sloppy OOP designer. I must admit I am new to this paradigm. > > Thanks in advance. > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > Share information about yourself, create your own public profile at > http://profiles.msn.com. > > -- > 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 -- ========================== Michael Kimsal http://www.tapinternet.com 734-480-9961

« previous php.general (#24323) next »