[Zope] how to iterate through two sequence items

Smith, Neil Neil.Smith@npower.com
Fri, 8 Feb 2002 11:43:54 -0000


> >Why not do it like this
> >
> >  -------------------------------------------
> >  | 1.item - 1.prop<br> |2.item - 1.prop<br> |
> >  | 1.item - 2.prop     |2.item - 2.prop     |
> >  -------------------------------------------
> >  | 3.item - 1.prop<br> |4.item - 1.prop<br> |
> >  | 3.item - 2.prop     |4.item - 2.prop     |
> >  -------------------------------------------
> >
> >Neil
> 
>  thanks neil
> 
> it's a question of layout and it would be nice to have the possibilty to
iterate through two or > more sequence items in one pass, wouldn't it?
> 
> Peter

OK, then why not do something like:

<dtml-in "objectValues('my Object')>
  <dtml-if sequence-odd>
    <dtml-if sequence-last>
      <tr>
      <td><dtml-var expr="getProperty('firstProp')"></td>
      <td>&nbsp;</td>
      </tr><tr>
      <td><dtml-var expr="getProperty('secondProp')"></td>
      <td>&nbsp;</td>
      </tr>
    <dtml-else>
      <dtml-set save_prop_one="getProperty('firstProp')">
      <dtml-set save_prop_two="getProperty('secondProp')">
    </dtml-if>
  <dtml-else>
    <tr>
    <td><dtml-var prop_one></td>
    <td><dtml-var expr="getProperty('firstProp')"></td>
    </tr><tr>
    <td><dtml-var prop_two></td>
    <td><dtml-var expr="getProperty('secondProp')"></td>
    </tr>
  </dtml-if>
</dtml-in>

**********************************************************************
 
The information contained in this e-mail is confidential and intended only for the use of the addressee. If the reader of this message is not the addressee, you are hereby notified that you have received this e-mail in error and you must not copy, disseminate, distribute, use or take any action as a result of the information contained in it.
    
If you have received this e-mail in error, please notify postmaster@npower.com (UK 01384 275454) and delete it immediately from your system.
    
Neither Npower nor any of the other companies in the Innogy group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses.

Npower Limited
Registered office: Windmill Hill Business Park, Whitehill Way, Swindon SN5 6PB. Registered in England and Wales: number 3653277

This e-mail may be sent on behalf of a member of the Innogy plc group of companies.

**********************************************************************