I would do this:
{{def display(i,row):}}
<div class="product_title">{{=i}} . {{=A(row.product_name,
_href=URL('indv_product', args=row.id))}} </div>
<div class="product_img">
<img id="post_view" src="{{=URL('default','download',
args=row.image)}}"
width="100" height="100"
onclick="this.src='{{=URL('default','download',
args=row.image)}}'; this.height=420;this.width=300"
ondblclick="this.src='{{=URL('default','download',
args=row.image)}}';this.height=100;this.width=100" title="Click to
Enlarge
Image" border="2"></a></div>
<div class="prod_price"><!-- insert data here -->
<br />
<br />
</div>
{{return}}
<table>
{{for i,row in enumerate(rows):}}
{{if i%3==0:}}<tr>{{pass}}
<td>{{display(i,row)}}</td>
{{if i%3==2:}}</tr>{{pass}}
{{pass}}
{{# fill up blanks #}}
{{for j in range(i%3,2):}}<td></td>{{pass}}{{if i%3!=2}}</tr>{{pass}}
</table>
On Oct 3, 5:58 pm, Andrew Evans <[email protected]> wrote:
> Hello all
>
> I am facing a challenge in my code for some reason the logic to generate a
> group of div tags in a 3 by 3 column is eluding me
>
> here is my code I am missing something can anyone help
>
> if you can help by showing me a way to avoid using tables that would be
> great if not and end up using tables thats fine to
>
> {{counter = 0}}
> <h3>Displaying Current Products</h5>
> <table>
> {{i = 1}}
>
> {{for row in rows:}}
> {{if counter == 0:}}
> <tr>
> {{pass}}
> <td>
> <div class="prod_box">
> <div class="center_prod_box">
>
> <div class="product_title">{{=i}} . {{=A(row.product_name,
> _href=URL('indv_product', args=row.id))}} </div>
> <div class="product_img">
> <img id="post_view" src="{{=URL('default','download', args=row.image)}}"
> width="100" height="100" onclick="this.src='{{=URL('default','download',
> args=row.image)}}'; this.height=420;this.width=300"
> ondblclick="this.src='{{=URL('default','download',
> args=row.image)}}';this.height=100;this.width=100" title="Click to Enlarge
> Image" border="2"></a></div>
>
> <div class="prod_price"><!-- insert data here -->
>
> <br />
> <br />
> </div>
> </td>
> {{if counter == 3:}}
> </tr>
> {{pass}}
>
> {{counter += 1}}
>
> {{if counter == 4:}}
> {{counter = 0}}
> {{pass}}
>
> {{pass}}
> </table>
>
> *cheers