Awesome, great tip. It works just fine in PHP 5, but after gooogling more information about references and values, it appears that PHP 5 supports references automatically. I was trying to get it to work under 4.3.8 which I had to use the &. For anyone else, this page goes into more depth: http://www.webreference.com/programming/phpanth2/5.html Thanks! "Zareef Ahmed" <za@xxxxxxxx> wrote in message news:003401c4c54d$d21483d0$0100a8c0@xxxxxxxxxxx > > Hi, > > Please visit > > http://www.phpcertification.com/manual.php/functions.arguments.html#func > tions.arguments.by-reference > > Hope it will be helpful. > > > zareef Ahmed > > -----Original Message----- > From: Jonathan Chum [mailto:jchum@xxxxxxxxxxxxx] > Sent: Monday, November 08, 2004 9:52 AM > To: php-general@xxxxxxxxxxxxx > Subject: OOP, Out of Scope Issue > > > I have a class called FrontEnd which extends a TemplateManager class. > > The purpose of the TemplateManager class is to initate Smarty. > > So my FrontEnd constructor looks like this: > > function FrontEnd() > { > $db = new DatabaseConnection(); > > $this->db = $db->initDatabase(); > $this->sm = $this->initTemplate(); > } > > I have another function: > > function DisplayMain($parentID) > { > if (!isset($parentID)) $parentID = '1'; > > $product = new Products($this->db, $this->sm); > > $category = new Categories($this->db, $this->sm); > > $category->FetchCategories($parentID); > $product->FetchProducts($parentID); > > $this->DisplayPage('display-products'); > } > > I'm passing in an instance of the smarty object instantiated by the > FrontEnd > constructor into Products and Categories. The FetchCategories and > FetchProducts methods will take the smarty instance and assign the > variables > into the template, assuming it's the same instance of Smarty. The > problem > I'm having is that it sees in each class a new instance of Smarty or a > copy > of the object which when I call DisplayPage, a method within the > FrontEnd > class, it doesn't see all of the variables I assigned earlier by > FetchProducts and FetchCategories even though I've not declared a new > instance of Smarty. > How can I fix it so that it uses the same Smarty object and not a copy? > > ------------------------------------------------------------------------ > -- > Zareef Ahmed :: A PHP develoepr in Delhi ( India ) > Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php