Symfony2, Twig: Better use block or variable?
block, symfony, twig, variables
Solution
I'd go with blocks. Also, remember that if you want to output contents of a block more than once, you can use the `block` function:
<title>{% block title %}{% endblock %}</title>
<h1>{{ block('title') }}</h1>
Problem
What solution is better and recommended for short string elements? To define block and let user override it contents like: ``` <title>{% block title %}{% endblock %}</title> ``` or make block of variables, set their default values and let user import this block reset variable he want like: base template: ``` {% block variables %} {% set meta.title = '' %} {% endblock %} <title>{{ meta.title }}</title> ``` user template: ``` {% block variables %} {{ parent() }} {% set meta.title = 'some title' %} {% endblock %} ```