Array with references, get_tpl_var()
| From: | Ferdinand Beyer | Date: | Wed, 07 Aug 2002 18:13:49 +0000 |
| Subject: | Array with references, get_tpl_var() | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5615@lists.php.net to get a copy of this message | ||
Hi,
let me suggest two additions to make Smarty more complete.
What about updating assign() and append() to handle references in
arrays?
$smarty->assign(array(
'obj' => &$obj,
'str' => &$str
));
Furthermore I want to suggest a new method. It's really a very simple
method and I wonder that nobody besides me misses it:
function get_tpl_var($name)
{
return isset($this->_tpl_vars[$name]) ? $this->_tpl_vars[$name] :
null;
}
I needed such a function to get a template variable for a plugin
without accessing the private array or getting all vars with
get_tpl_vars().
--
Ferdinand Beyer
<fbeyer@clickhand.de>