RE: [SMARTY] Assign a reference to a variable

From: Date: Fri, 02 Aug 2002 07:23:56 +0000
Subject: RE: [SMARTY] Assign a reference to a variable
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5546@lists.php.net to get a copy of this message
Is it a problem? In the first example you are passing a copy of $myobj to the templates and then modifying the attributes of the original object (not the one passed to the templates). In the second example you are passing by reference, so further changes will affect the object known to the templates. This is intended behavior... ----------------------------------------------------------- Rasmus T. Mohr Phone : +45 70 117 117 Application Developer Direct : +45 36 910 122 Netpointers Intl. Mobile : +45 28 731 827 Vestergade 18 B Website : www.netpointers.com 1456 Copenhagen K Email : rmo@netpointers.com > -----Original Message----- > From: Hendy Irawan [mailto:ceefour@gauldong.net] > Sent: Friday, August 02, 2002 8:40 AM > To: smarty-general@lists.php.net > Subject: [SMARTY] Assign a reference to a variable > > > smarty-general, > > I want to do something like: > > $smarty->assign('myobj', $myobj); > > Where $myobj is an object. However, later I want to change $myobj > (before displaying the template) but the changes are not visible. > > Doing: > > $smarty->assign('myobj', &$myobj); > > seems to have no effect. > > Is there a way to solve this problem? > Assigning these variables exactly before it's displayed is not a > solution. > > Salam hangat, > Hendy Irawan - www.GaulDong.NET > Kantor: (021) 5260467 [SoftVation] > Kos: (021) 5261839 [kamar 3] > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

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