Skip to main content

Modifiers

You can modify the returned values of your variable in your application code in template using modifiers.

How to use modifiers

Modifiers are separated from the variable using pipe symbol ( | ) and may have an optional argument separated by colon symbol ( : ). Multiple modifiers can be chained, it modifies the variable from left to right. Thus, the output of the first filtering is applied to the next filtering.

{{ $var|noescape|function:param }}

noescape

Fegg is automatically escaping character values. If you don’t want a escaping value, you can use the noescape modifier.

Controller
$this->page['foo'] = '<p>bar</p>';
Template
{{ $page.foo }} -> <p>bar</p>
{{ $page.foo|noescape }} -> bar

br

Insert HTML line breaks for all newline (\n) found in a string.

Controller
$this->page['foo'] = "This is a test text.\n This is a new line text.";
Template
{{ $page.foo }} -> This is a test text. This is a new line text.
{{ $page.foo|br }} -> This is a test text.
This is a new line text.