[Zope] neat trick

magnus@websys.no magnus@websys.no
23 Nov 2000 05:36:28 +0100


Just wanted to share something that I thought was kind of neat (if
obvious).  I often present properties from a property sheet, and this
is an easy way to do it:

Assuming there are three fields in the property sheet, called field1, field2
and field3.

<table>
 <tr><th>Name</th><th>Value</th></tr>
 <dtml-in "('field1', 'field2', 'field3')">
  <dtml-if "_[_['sequence-item']]">
   <tr>
    <td>
     <dtml-var "_['sequence-item']" capitalize>
    </td>
    <td>
     <dtml-var "_[_['sequence-item']]">
    </td>
   </tr>
  </dtml-if>
 </dtml-in>
</table>

It will give you something like this:

        Name    Value
        ------- -----
        Field1  abc
        Field2  def
        Field3  ghi

-Magnus