On 1/28/06, Martina Oefelein <[EMAIL PROTECTED]> wrote:
Am 28.01.2006 um 08:10 schrieb deezthugs:
> I just want to print a <br/> after every 5th <a href>:
>
> <span py:for="" in enumerate(tag_list)" class="${i%2 and
> 'row_even' or 'row_odd'}">
> <a href=""
> <!-- output <br> here after every 5th a href -->
> </span>
>
> This seems so simple. I have spent an hour or more on this simple
> functionality with no sucess. This has got to be an easy task.
Easy:
<span py:for="" in enumerate(tag_list)" class="${i%2 and
'row_even' or 'row_odd'}">
<a href=""
<br py:if="(i % 5) == 0" />
</span>
If the length of tag_list is divisible by 5, this will also ouitput a
<br> at the end of the list. If you want to suppress this:
<span py:for="" in enumerate(tag_list)" class="${i%2 and
'row_even' or 'row_odd'}">
<a href=""> <br py:if="(i % 5) == 0 and i != len(tag_list) - 1" />
</span>
ciao
Martina

