Re: OO Design and Implementation in PHP

From: Date: Wed, 16 Aug 2000 12:06:26 +0000
Subject: Re: OO Design and Implementation in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-11970@lists.php.net to get a copy of this message
Jason Crane wrote: > > I'm not sure if this issue has been addressed, but I shall persevere none-the-less. =) > > I'm currently undergoing a redesign of a site that I wrote in PHP haphazardly. The plan > is to make the entire site OO driven, in that the index.php file only contains the instantiation of > of the super class which runs the whole show. > > My problem is thus: > > I have a class called Database, contained in the file classes/core/Database.php. Another > class, Article (contained in classes/core/Article.php) uses the Database class to load in an > article. At the top of the Article.php file, I have a "require" clause to require the > Database class, as PHP spits the dummy if I try to declare a class within a class. > > So far, this all sounds simple and indeed, it is not rocket science. My problem arises when I > develop the site a bit more, and have two classes being included which both want to instantiate the > Database class. There is a high probability that index.php will eventually contain half-a-dozen or > so classes that all want to do database calls and require instantiations of the Database class. > *** use require_once() hellekin

« previous php.general (#11970) next »