Beaver Builder Child Theme

Twig delimiters

Estimated reading: 1 minute

Whenever you create a Twig template you can use three kinds of delimiters. The delimiters are what tells the layout where regular HTML ends and something needs to be rendered or executed.

1. Render delimiter

{{ foo }}

this delimiter is used when you want to render something to the browser directly, or return something (more on that later).

It’s comparable to the PHP ‘echo’ construct.

2. Execute statements

{% for item in posts %}
{% endfor %}

This delimiter {%%} does not render anything, but is used to execute statements such as for-loops, include, import, set values and control inheritance.

3. Comments

{# this is a comment #}

Comments are an important part of the template. It allows you to write something about the template to explain something, or temporarily disable a part of the logic.

Share this Doc

Twig delimiters

Or copy link

CONTENTS