Yaffs site version 1.1
[yaffs-website] / vendor / twig / twig / doc / tags / sandbox.rst
1 ``sandbox``
2 ===========
3
4 The ``sandbox`` tag can be used to enable the sandboxing mode for an included
5 template, when sandboxing is not enabled globally for the Twig environment:
6
7 .. code-block:: jinja
8
9     {% sandbox %}
10         {% include 'user.html' %}
11     {% endsandbox %}
12
13 .. warning::
14
15     The ``sandbox`` tag is only available when the sandbox extension is
16     enabled (see the :doc:`Twig for Developers<../api>` chapter).
17
18 .. note::
19
20     The ``sandbox`` tag can only be used to sandbox an include tag and it
21     cannot be used to sandbox a section of a template. The following example
22     won't work:
23
24     .. code-block:: jinja
25
26         {% sandbox %}
27             {% for i in 1..2 %}
28                 {{ i }}
29             {% endfor %}
30         {% endsandbox %}