TAL code for making rows
Use case: you can repeat over items no problem, but how do you split it up into rows? Closing tags don't allow conditions. You can insert the wrapping row tags using the code below. This example splits the items up intro three per row.
<tal:thumbs repeat="item items">
<tal:num define="num repeat/item/number;
end repeat/item/end">
<tal:open condition="python:num % 3 == 1"
content="structure string:<div class='row'>" />
<img tal:attributes="src item/absolute_url;
alt item/Title"/>
<tal:close condition="python:(num % 3 == 0) or end"
content="structure string:</div>" />
</tal:num>
</tal:thumbs>
Written by Chrissy Wainwright
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#