Here is the final version – it uses Django Template Objects and Contexts… just pass the appropriate function and it generates your table:

<code>
#Repeater with Templating &amp; multiple vars!
def another_repeater(cols, template, var, repeatme, tableclass):
out = "
<table class="
&quot; + tableclass + &quot;" border="0" cellpadding="2">
<tbody>
<tr>"

rows = len(repeatme) / colscolcount = 0
for item in repeatme:
newcontext = Context({var:item})
entry = template.render(newcontext)

if colcount &lt; cols:
out += "
<td>"

out += entry
out += "</td>
"

colcount += 1
else:
out += "</tr>
<tr>"

out += "
<td>"

out += entry
out += "</td>
"

colcount = 0

out += "</tr>
</tbody></table>
"


return out
</code>

Usage:

<code>
tableformat = Template("<a href='/Portfolio/{{port.id}}'> <img src='/{{port.get_Thumbnail_url}}' /> </a> <a href='/Portfolio/{{port.id}}'>{{port.Title}}</a>") #This is the template
tableclass = 'portfolio' #the class to assign to the table for formatting
vars = "port" #The identifier for the Context
   
thistable = another_repeater(2, tableformat, vars, myport, tableclass)
</code>

Enjoy! :-)