RE: [SMARTY] Smarty inside class

From: Date: Sun, 13 Oct 2002 15:51:33 +0000
Subject: RE: [SMARTY] Smarty inside class
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6122@lists.php.net to get a copy of this message
Or, if you don't want to use globals, pass the Smarty instance in to your functions as a reference: class MyClass { function func($params, &$smartyobj) ( $smartyobj->assign... } } or assign the Smarty instance to a class member variable as a reference: class MyClass { var $smartyobj; function MyClass(&$smartyobj) { $this->smartyobj =& $smartyobj; } } >-----Original Message----- >From: Ray A. Akey [mailto:ray@codemain.com] >Sent: Saturday, October 12, 2002 7:04 PM >To: Eskil Kvalnes; Smarty Mailing List >Subject: Re: [SMARTY] Smarty inside class > > >Do a "global $smartyobj;" inside the method which you need to access. > > >Ray > > > >----- Original Message ----- >From: "Eskil Kvalnes" <eskil@uten.net> >To: "Smarty Mailing List" <smarty-general@lists.php.net> >Sent: Saturday, October 12, 2002 5:45 AM >Subject: [SMARTY] Smarty inside class > > >> Hey, >> >> I've been trying to get smarty to assign two variables >inside a class, but >> no matter what I do, it doesn't work. >> >> My class is being called after I've instanciated Smarty so I >thought that >my >> class could just use $smartyobj->assign.... doesn't seem to >work though :/ >> >> Any ideas? >> >> --------------- >> Sincerely, >> Eskil Kvalnes >> eskil@uten.net >> >> >> >> -- >> Smarty General Mailing List (http://smarty.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > >-- >Smarty General Mailing List (http://smarty.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.general (#6122) next »