> I had the same problem and found out there is no way yet of making dtml-in
> with multiple conditions. Instead I had to do dtml-if's and make my own
> counter and previous/next attributes to handle the batches.
One way to simplify this is to use two dtml-in loops. The first one 
filters out the items you want to include, then the second one just 
displays all the items in the filtered loop.

So instead of:
   <dtml-in sequence><dtml-if "somecomplexcondition">
      messing around with counters and stuff goes here...

You have something like:
   <dtml-let seq="[]">
   <dtml-in sequence><dtml-if "somecomplexcondition">
       <dtml-call "seq.append((_['sequence-key'], _['sequence-

   <dtml-in seq> Put your real loop body here. </dtml-in>

The second sequence then has the correct counter, and you can 
use the next/prev batches on it as well if you want.

When building the second sequence you have a choice of how to 
structure it. If you simple append sequence-item, this should work, 
unless the sequence items are two element tuples. If you append a 
tuple as shown this should work every time. It can also be useful to 
calculate a new key, for example if you wanted to sort the list on 
more than one field you could build a key from the sorted fields.

The main downside to this scheme is that you have to process the 
whole list, which could be annoying if you just want a small batch 
from the front of a long list.

Duncan Booth                                             [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to