[Zope] Re: dtml-Variablen in <dtml-in> loops?
Tino Wildenhain
tino@wildenhain.de
Sun, 27 May 2001 17:38:48 +0200
Hi Philipp,
--On Sonntag, 27. Mai 2001 16:08 +0200 Philipp Robbel=20
<philipp.robbel@eml.villa-bosch.de> wrote:
> Hello again,
>
> Allright :-)
> I have cached the results of a sql-Method via <dtml-let
> DATA=3DsqlListProjects>.
> GroupID ProjectID Project
> 1 1 "Gurr"
> 1 2 "Muh"
> 2 3 "Ih-Ah"
> 3 4 "M=C3=A4hh"
> 3 5 "WauWau"
>
> A second sqlMethod (sqlCount) returns:
> Count
>| 2 |
> ----
>| 1 |
> ----
>| 2 |
> ...
>
> The two sql-Methods are related: Count shoes, how many Projects belong
> to one GroupID.
> Now imagine that I want to print out the projects in the following way:
>
> GroupID 1:
> Gurr, Muh
>
> GroupID 2:
> Ih-Ah
>
> GroupID 3:
> M=C3=A4h, WauWau
>
First of all, you dont have to cache SQL results via dtml-let. Zope
does this already for you.
If you have 2 queries:
sqlGroupList:
SELECT DISTINCT GroupID FROM Projects
and the other:
sqlProjectList(arg_GroupID)
SELECT ProjectID, Project FROM Projects WHERE GroupID=3D<dtml-arg_GroupID=20
type=3Dint>
so you can:
<dtml-in sqlGroupList>
GroupID &dtml-GroupID;:
<dtml-in "sqlProjectList(arg_GroupID=3DGroupID)">
<dtml-unless sequence-start>,</dtml-unless>
<dtml-var Project>
</dtml-in>
</dtml-in>
This looks a bit cleaner imho ;)
Regards
Tino Wildenhain