Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Add separator div tag after each 2 column inside custom loop

Started by Muut Archive 10 years ago · 6 replies · 598 views
10 years ago

we just try to add a separator after each 2column inside loop we when we write code like below we getting error

{% set i=2 %}
{% for ps in taxonomy.findTaxonomy({'Post Type':[page.title]}) %}
statement - -----------
{% if(i%2==0)%}
<div class="clear line"></div>
{% endif%}
{% i++ %}

TWIG
        {% endfor %}

anyone can help me how we set

Thanks

10 years ago

Why not just add the seperator via CSS? You can use nth-child selector without any extra HTML.

10 years ago

no i just want to be from it any idea?&quest;
how we set

10 years ago

can you please give me soluation how we set

10 years ago

if we want to be write some thing like above any idea how to set it
when we set i++ it giving error

10 years ago

Now i got the solution here we can set

{% set i = 1 %}
{% for ps in taxonomy.findTaxonomy({'Post Type':'blog'})|slice(0, 10) %}
<h2><a href="{{ps.url}}">{{ps.title}}</a></h2>
{% if(i%2==0)%}
<div>for separtor</div>
{% endif%}
{% set i = i + 1 %}
{% endfor %}

we can used something like above

Thanks

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 674 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago