Applies filters on a section of a template.
{% apply upper %} This text becomes uppercase {% endapply %}
Marks a section of a template to be escaped or not.
{% autoescape true %} Everything will be automatically escaped in this block {% endautoescape %}
{% autoescape false %} Everything will be outputed as is in this block {% endautoescape %}
{% autoescape true js %} Everything will be automatically escaped in this block using the js escaping strategy {% endautoescape %}
Marks a section of a template as being reusable.
{% block head %}
{% endblock %}
Deprecates a section of a template.
{% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} {% extends 'layout.html.twig' %}
Embeds a template.
{% include 'header.html' %} Body {% include 'footer.html' %}
Filters a section of a template by applying filters.
{% filter upper %} This text becomes uppercase {% endfilter %}
Loops over each item of a sequence.
Tests a condition.
{% if users %}
{% endif %}
Includes a template.
{% include 'header.html' %} Body {% include 'footer.html' %}
Defines a macro.
{% macro input(name, value, type, size) %}
{% endmacro %}
Marks a section of a template as untrusted code that must be evaluated in the sandbox mode.
{% sandbox %} {% include 'user.html' %} {% endsandbox %}
Defines a variable.
{% set foo = 'foo' %} {% set foo = [1, 2] %} {% set foo = {'foo': 'bar'} %} {% set foo = 'foo' ~ 'bar' %} {% set foo, bar = 'foo', 'bar' %} {% set foo %}Some content{% endset %}
Remove whitespaces between HTML tags.
{% spaceless %}
{% endspaceless %} {# output will be