Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display blog posts in two columns
#1
I want to diplay the list of my blog posts in a row with two columns. So I tried;

{% 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?
Reply


Messages In This Thread
Display blog posts in two columns - by saladgg - Dec-27-2018, 08:24 PM
RE: Display blog posts in two columns - by nilamo - Dec-27-2018, 08:48 PM
RE: Display blog posts in two columns - by saladgg - Dec-28-2018, 05:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Scraping Columns with Pandas (Column Entries w/ more than 1 word writes two columns) BrandonKastning 7 3,221 Jan-13-2022, 10:52 PM
Last Post: BrandonKastning
  Post comments to Wordpress Blog SergeyLV 1 2,513 Aug-01-2019, 01:38 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020