[Zope] ZPT and SQL
Samuele Giovanni Tonon
samu at sferacarta.com
Tue Apr 20 06:37:40 EDT 2004
hi,
i would like to access to results from a Query without knowing before
names returned from the SQL and all with ZPT
i think it could be clear with this example:
suppose you have ZPT with this inside:
<table tal:define="list_ppl container/show_list">
<tr tal:repeat="res list_ppl">
<td tal:content="res/name">Name</td>
<td tal:content="res/lastname">Lastname</td>
</tr>
</table>
show_list is this SQL method " SELECT * from ppl"
this work, but i would like to make that table dynamic, so that
i haven't to call esplicit the name of the column "name" and "lastname".
Also it means that the number of td will change (so i should
nest some tal:repeat inside ).
i saw it's possible to ref to data inside res with index
( (res[0], res[1]) and i tried something like this
but it's not working.
Any tips ?
<table tal:define="list_ppl container/show_list">
<tr tal:repeat="res list_ppl">
<span tal:define="num python:range(len(res))">
<span tal:repeat="vars python:res[num]">
<td tal:content="vars">vars</td>
</span>
</span>
</tr>
</table>
i tried to search on google for some example of this kind but got no clue
TIA
Samuele
More information about the Zope
mailing list