David Xiao wrote:
> I am not quite understand how to generate KID template in that way.
> For example, pics = Pictures.select(orderBy='shortname') returns 5
> results, and I want the HTML code look like, 2 elements per row:
> <table>
> <tr>
> <td>result 1</td>
> <td>result 2</td>
> </tr>
> <tr>
> <td>result 3</td>
> <td>result 4</td>
> </tr>
> <tr>
> <td>result 5</td>
> <td></td>
> </tr>
> </table>
>
> How should I write .kid template code?
You can try something like this:
<tr py:for="i in range((len(pics)+1)//2)">
<td><img src="${pics[2*i]}" /></td>
<td><img py:if="len(pics)>2*i+1" src="${pics[2*i+1]}" /></td>
</tr>
-- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---