Forum
How do you output a counting variable?
Hi,
I have a question from a developer who I often collaborate with on website projects but is new Perch:
In Perch for a loop of posts, how do you output a counting variable?
For example
<div id="1"></div> <div id="2"></div>
//on an even count, put this div here
<div class="clear"></div>
So output would be
<div id="1"></div> <div id="2"></div> <div class="clear"></div> <div id="3"></div> <div id="4"></div> <div class="clear"></div> <div id="5"></div> <div id="6"></div> <div class="clear"></div>
I look forward to your comments
Hi Neil
It's all in the templates...
You can even do nth-child values like CSS.
Read it here: https://docs.grabaperch.com/docs/templates/conditionals/every
Thanks Michael - perfect :)