Reputation: 359
I've wondered if there is an equivalent for the macro function from twig http://twig.sensiolabs.org/doc/tags/macro.html in smarty.
I don't want to use smarty plugins for that because I want be able to write these macros right into the templates.
The only thing I found was the template inheritance with {block}
http://www.smarty.net/docs/en/advanced.features.template.inheritance.tpl, but I want to pass arguments too.
Is there any equivalent for that?
In my example I want to use this for html forms and inputs like
<input type="{$type}" name="{$name}" value="{$value} [...]>
{$type}
, {$name}
, and {$value}
are the arguments
Upvotes: 1
Views: 1878
Reputation: 97688
Yep, Smarty 3 has the {function}
tag which does exactly that: http://www.smarty.net/docs/en/language.function.function.tpl
Upvotes: 4