The echo directive is used to print data to the output stream.

[% echo foo %]

Since echoing is the primary purpose of using a templating language, an implied echo is available as a shortcut. If a code chunk contains only a single statement which is a non-assignment expression, it is assumed to be an echo directive.

[% foo %]

If you have a single non-assignment expression within a code chunk and you do not want the results of that expression automatically echoed, use the call directive. For example:

[% foo('item': 'value') %]

The above code will echo results of macro foo. To suppress output:

[% call foo('item': 'value') %]

The above code will not echo results of macro foo.

Tags