Topics

Modifiers (plugins)

Smarty 'Modifiers' are little functions that are applied to a variable in the template before it is displayed or used in some other context.

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 modifier name and are separated by a : (colon). Also, all php-functions can be used as modifiers implicitly and modifiers can be combined by 'piping' them through additonal modifiers.

{* apply modifier to a variable *}
{$title|upper}

{* modifier with two parameters *}
{$title|truncate:40:"..."}

{* multiple modifiers *}
{$articleTitle|lower|truncate:30|spacify}
Loading Help