Dec-27-2018, 08:24 PM
I want to diplay the list of my blog posts in a row with two columns. So I tried;
Invalid block tag on line 18: 'set', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
#18: {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}
What am I missing or what is the right approach?
{% for post in posts %} {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %} {% if oddOrEven == 'odd' %} <div class="col-md-6">Odd posts</div> {% else %} <div class="col-md-6">Even posts</div> {% endif %} {% endfor %}But I get the error:
Invalid block tag on line 18: 'set', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
#18: {% set oddOrEven = cycle(['odd', 'even'], loop.index0) %}
What am I missing or what is the right approach?