Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Add separator div tag after each 2 column inside custom loop

Started by Muut Archive 10 years ago · 6 replies · 433 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 Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago