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 needs to access either one. Your user class should have am instance of both because your user class should be what pulls the data from the database, and then pushes it to the Smarty class for display. Maybe I am way off here, but essentially that is how it should be done IMHO.
Jeremy On Sun, 2003-10-05 at 17:57, Gerard Samuel wrote: > 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; > > > > function smarty(&$db) > > { > > $this->db = &$db; > > } > >} > > > >This way you don't have the wasted memory of duplicate class instances. > >Of course PHP5 will make this easier as it passes objects by reference > >by default. > > > This is currently how Im doing things. > And this is what Im trying to get away from. > In addition to passing smarty the $db object by reference, Im going to > be passing > the user management object to smarty by reference, which in turn has a > copied reference to the $db object. > So in the end the smarty object is going to have 2 references to the $db > object. > That is what I want to get away from... > $smarty <- $db (by reference) > $smarty <- $user_management (by reference) <- $db (by reference) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php