From: sshikari@...
Date: 2006-12-18T01:55:09+09:00
Subject: Looping: break every x times
I have a bunch of pictures to display on a page and I want to do 4 per
row. This code works fine (inserting a
every 4th picture):
<% i = 1 %>
<% for photo in @photos do -%>
<% if (i.modulo(4) == 0) %>
<% end %>
<% i = i+1%>
<% end %>
but I was wondering if there is a more elegant way to do this. Thanks.