Arrays as param to custom functions
| From: | Martin Kjeldsen | Date: | Tue, 01 Jun 2004 17:46:18 +0000 |
| Subject: | Arrays as param to custom functions | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11420@lists.php.net to get a copy of this message | ||
Hi,
it's it possible to pass functions a assoc array instead of naming all the
variables. That would enable dynamic use of custom functions like
{html_select_date} which takes a lot of parameters and I don't know how to
pass variables if sometimes I want to leave some out. The best solutions
would be to:
{html_select_date $html_select_params}
A simple fix, which I could put in all custom functions, is to just pass a
array
{html_select_date params=html_select_params}
And put this in the custom function
if (isset($params['params']) && is_array($params['params']))
$params = &$params['params'];
of course before the extract or the foreach...
Cheers
Martin