[Zope] DTML vs ZTP

Florent Guillaume fg at nuxeo.com
Mon Dec 13 11:45:55 EST 2004


> 4)The insistence on proper XML nesting can be annoying.
>   For example, I frequently used to use a simple expedient
>   for rendering tables with an array of data set to a given
>   width:
> 
>   <table>
>   <tr>
>   <dtml-in mydatalist prefix="sq">
>   <td>&dtml-title_or_id;</td>
>   <dtml-if expr="sq_index % 4 = 4">
>   </tr><tr>
>   </dtml-if>
>   </dtml-in>
>   </tr>
>   </table>
> 
>   which you basically can't do in ZPT. 
> 
>   IMHO, the number of columns you choose to print a
>   collection of data at is PRESENTATION, not LOGIC, so
>   the fact that ZPT makes me put that decision into
>   a Python script (my ZPT solution requires making 
>   'mydatalist' return a sequence of sequences for each
>   row, instead of just a plain list) seems extremely
>   ironic, given the wild claims made about it.

Well there's always a way to hack it in using structure, like in:

  <table>
    <tr>
      <tal:block repeat="item mydatalist">
      <td tal:content="item/title_or_id">Title</td>
      <div tal:condition="python:repeat['item'].index % 4 == 3"
           tal:replace="structure string:</tr><tr>" />
      </tal:block>
    </tr>
  </table>

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list