Re: [PHP] OO parent/child relationship

2003-10-06 Thread Gerard Samuel
Andy Crain wrote: This all seems like a perfect case for the singleton pattern. See http://www.phppatterns.com/index.php/article/articleview/6/1/1/ and http://www.phppatterns.com/index.php/article/articleview/75/1/1/ Andy Im currently trying to wrap the brain around the Singleton Registry article.

RE: [PHP] OO parent/child relationship

2003-10-06 Thread Andy Crain
t: Monday, October 06, 2003 2:07 AM > To: Robert Cummings; Curt Zirzow > Cc: PHP List > Subject: Re: [PHP] OO parent/child relationship > > Aye. PHP already reserves function names prepended with __ as magic. But > really one could make this argument ad infinitum. If everyo

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Evan Nemerson
Aye. PHP already reserves function names prepended with __ as magic. But really one could make this argument ad infinitum. If everyone wants to start their variables with a *insert random character here*, "*grin*" IMHO it's good advice to "prepend global vars with '__' or something". I usually

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Robert Cummings
On Mon, 2003-10-06 at 00:48, Curt Zirzow wrote: > > On the global topic, I would suggest establishing a standard > naming convention for your common globals that are used, I do > something like: > $__object_something__; > > With your global var I can see myself writing something that will > over

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Curt Zirzow
* Thus wrote Tom Rogers ([EMAIL PROTECTED]): > Hi, > > Monday, October 6, 2003, 3:20:08 AM, you wrote: > > > To do this I have my classes register themselves in a global array. > For example a mysql class which gets used a lot does this in its constructor: > > function mysql_class($db='',$ini='

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Gerard Samuel
Tom Rogers wrote: To do this I have my classes register themselves in a global array. For example a mysql class which gets used a lot does this in its constructor: function mysql_class($db='',$ini=''){ global $class_ref; $class_ref["mysql_class"] =& $this; . . . } Then any class that needs ac

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Gerard Samuel
Jeremy Johnstone wrote: I would have to see your code That can be arranged. Ill email you offlist. , but maybe you don't need to be passing the references your doing. Why does your Smarty class need to access the database? Why does your Smarty class need a reference to the user management class i

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Jeremy Johnstone
I would have to see your code, but maybe you don't need to be passing the references your doing. Why does your Smarty class need to access the database? Why does your Smarty class need a reference to the user management class inside it? Personally, I see your user class being the only one which nee

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Gerard Samuel
Jeremy Johnstone wrote: What I would do is pass the handles to the objects in the class constructor by reference. For example create one db object similar to this: class database { ... } $db = new database(); and then pass the reference to all other classes like this: class smarty { var $db;

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Jeremy Johnstone
What I would do is pass the handles to the objects in the class constructor by reference. For example create one db object similar to this: class database { ... } $db = new database(); and then pass the reference to all other classes like this: class smarty { var $db; function smarty(

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Gerard Samuel
Dan Anderson wrote: Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) In my current setup, the more classes Im adding to the code, the more complex things seem to get. For example. I have a smarty object that

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Dan Anderson
Out of curiousity, what exactly are you trying to do? Are you sure this type of framework is most appropriate (and easiest to implement?) -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Gerard Samuel
Dan Anderson wrote: Im looking to verify some behaviour Im running into. When a child extends a parent, from that point on, the parent, has no idea, on what the child is capable of, or what it contains. Is that a "real" parent??? ;) No but if you really wanted to you could create a framew

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Dan Anderson
> Im looking to verify some behaviour Im running into. > When a child extends a parent, from that point on, the parent, has no idea, > on what the child is capable of, or what it contains. > Is that a "real" parent??? ;) No but if you really wanted to you could create a framework for paren

Re: [PHP] OO parent/child relationship

2003-10-05 Thread Curt Zirzow
* Thus wrote Gerard Samuel ([EMAIL PROTECTED]): > Im trying to create some dummy code where child classes can talk to each > other. > Im looking to verify some behaviour Im running into. > When a child extends a parent, from that point on, the parent, has no idea, > on what the child is capable of