M
M
magary42017-12-13 16:04:01
Twig
magary4, 2017-12-13 16:04:01

Render blocks in a specific order?

in the resulting html my-div1 should appear before my-div2
but it may also not appear if {% set flag = false %} is assigned in the process of some complex logic
how can this be achieved tell me

{% set flag = false %}

{% if flag %}
    <div class=“my-div1”>
  bla bla bla
    </div>
{% endif %} 

{% for a in arr %}
  …. куча сложной тяжелой логики
        <div class=“my-div2”></div>
          {% set flag = true %}
{% endfor %}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question