 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
SunWuKung Smarty Rookie
Joined: 20 Sep 2008 Posts: 20
|
Posted: Sat May 23, 2009 11:38 am Post subject: array as parameter for modifying variable |
|
|
I would like to do multiple replacement on a variable.
The documentation says that smarty replace acts like php replace but it only gives the syntax for scalars: {$articleTitle|replace:'Garden':'Vineyard'}
How do I do the same with arrays, like this?
{$phrase|replace:array("fruits", "vegetables", "fiber"):array("pizza", "beer", "ice cream")}
Thanks for the help.
SWK |
|
| Back to top |
|
SunWuKung Smarty Rookie
Joined: 20 Sep 2008 Posts: 20
|
Posted: Mon May 25, 2009 7:31 am Post subject: solved |
|
|
I found it using the set plugin.
{set var=$find value=array('aaa', 'bbb')}
{set var=$replace value=array('raaa', 'rbbb')}
{$document|replace:$find:$replace} |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|