Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple parameters to Smarty modifier

Tags:

php

smarty

Say I have a modifier that looks like this:

{$smarty.now|my_modifier:"param1"}

But imagine that my_modifier now expects two parameters and not just "param1". How would I pass those?

I want to do something like this:

{$smarty.now|my_modifier:"param1","param2"}
like image 916
Hommer Smith Avatar asked Dec 09 '22 19:12

Hommer Smith


1 Answers

According to the documentation, you simply separate them with a colon ":"

Variable modifiers can be applied to variables, custom functions or strings. To apply a modifier, specify the value followed by a | (pipe) and the modifier name. A modifier may accept additional parameters that affect its behavior. These parameters follow the modifer name and are separated by a : (colon). Also, all php-functions can be used as modifiers implicitly (more below) and modifiers can be combined. .

So I would assume

{$smarty.now|my_modifier:"param1":"param2"}

like image 172
emartel Avatar answered Dec 11 '22 10:12

emartel