Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-12 19:11:49

mmelon
Member
Registered: 2006-03-02
Posts: 95

conditionally output markup based on the repeat index?

Hi,

I looked but couldn’t find anything to solve this. If I am looping through an article list, how do i put (for example)

<div class=“clr”> <hr/>
</div>

..after every 3 articles output?

I use phptal at work and it is accomplished like

<div tal:condition=“php:repeat.item.number % 3” class=“clr”> <hr/>
</div>

I am almost certain smd_if should be able to do this. I can’t seem to find a list of txpvars to hook into.

Surely the repeat index is available?

Thanks for any help,
Mike

Offline

#2 2010-05-12 19:19:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: conditionally output markup based on the repeat index?

zem_nth is a simpler way to achieve it.

Offline

#3 2010-05-12 19:25:28

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: conditionally output markup based on the repeat index?

Thanks v much Els.

Offline

Board footer

Powered by FluxBB