[Zope] dtml-in syntax
Manuel Schulte
manuel@alpha.sea-to-sky.net
Sun, 30 Jul 2000 00:08:48 -0700 (PDT)
Would this do it? :
<dtml-let item=0>
<dtml-in wherever>
<dtml-let level="level+1">
</dtml-in>
</dtml-let>
Cheers,
Manuel
On Sat, 29 Jul 2000, Tim Cook wrote:
> Kyle Burnett wrote:
> >
> > so i have this loop and i want to count a variable:
> >
> > <dtml-in wherever>
> >
> > <dtml-if sequence-start>
> > <dtml-var count-id>
> > </dtml-if>
> >
> > </dtml-in>
> >
> > but what i really want to count is specific values for id. so let's say
> > id=='value1', i want to try and do the following:
> >
> > <dtml-in wherever>
> >
> > <dtml-if sequence-start>
> > <dtml-var "count-id=='value1'">
> > </dtml-if>
> >
> > </dtml-in>
> >
> > but no luck. and i have tried several other make-shift syntaxes to no avail.
> >
> > i do have some other logic that i could use over the course of the loop to
> > determine the count of distinct values but i was try to do it in far less
> > code.
>
> This may be what you already thought of. It does require a lot of
> code if you have several things to count. There may also be
> cleaner ways to do it???
>
> <dtml-call "REQUEST.set('this_count', 0)">
> <dtml-in wherever>
> <dtml-call "REQUEST.set('current_id', _['sequence-item'])">
> <dtml-if "current_id=='id_to_count'">
> <dtml-call "REQUEST.set('this_count', this_count+1)">
> </dtml-if current_id>
> </dtml-in wherever>
> I counted <dtml-var this_count> items.
>
> (of course this is untested)<g>.
>
> -- Tim Cook --
> FreePM Project Coordinator - http://www.freepm.org
> OS Healthcare Alliance Supporter - http://www.oshca.org
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>