When using a setup like:
{# main.twig #}
{% set test = false %}
<h1>Hello</h1>
{% block dialog %}
dialog base
{% endblock %}
{# test.twig #}
{% extends 'main.twig' %}
{% if false and test %}
{% block dialog %}
dialog override
{% if test == true %}
test is true
{% else %}
test is false
{% endif %}
{% endblock %}
{% endif %}
The output is:
<h1>Hello</h1>
dialog override
test is false
This is confusing. When printing anything in the extending template outside of the block a syntax exception is thrown like: A template that extends another one cannot have a body in "test.twig" at line 19.. I think an exception should be thrown as well when using conditionals outside of blocks.
Fiddle @ http://twigfiddle.com/818v58
When using a setup like:
The output is:
This is confusing. When printing anything in the extending template outside of the
blocka syntax exception is thrown like:A template that extends another one cannot have a body in "test.twig" at line 19.. I think an exception should be thrown as well when using conditionals outside ofblocks.Fiddle @ http://twigfiddle.com/818v58