Re: Passing in objects by reference (Pull approach w/ Smarty)

From: Date: Thu, 05 Jul 2001 18:27:04 +0000
Subject: Re: Passing in objects by reference (Pull approach w/ Smarty)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1118@lists.php.net to get a copy of this message
On Thu, 05 Jul 2001, Oleg Rekutin wrote: > So here's my question. Is it possible to pass in objects to Smarty > templates by reference? Something like assign("security", > $context->get('security'));, where all method calls to security within > the Smarty templates are performed on the reference returned by > Context::get. This way, only one copy of the security object is > maintained, and thus only one state is updated. > > For instance, all screen templates do $context->set('title', 'Log in') > and > then the layout template displays $context->get('title') in the > <title></title> tags. This requires that the screen template modifies > one and only one context object, thru a reference, so that the layout > template can retrieve the set value from the same object. > > However, as far as I see, assign() takes in the value by parameter and > not reference. Is there any way to have some sort of "assign_by_ref"? It would be possible to have assign take the value by reference. However, how would this be useful to you, since Smarty doesn't allow calling object methods in templates? -Andrei * Only 19,999 lines of C++ to my next ski trip... *

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