[Zope] iteration

Joel Burton jburton@scw.org
Tue, 6 Mar 2001 09:04:23 -0500 (EST)


On Tue, 6 Mar 2001, Alex Verstraeten wrote:

> print "<table>";
> print "<tr>";
> while ($item = current($array))
> {
>    for ($n=0 ;$n<3;$n++)
>    {
>       print "<td>$item</td>";
>       next($array);
>    }
>    print "</tr>";
> }
> print "</table>";
> 
> what this code does is to print all the contents of an array in a table of 3
> columns, using a cell for each element. I'm trying to do this same thing but
> using a <dtml-in expr="objectValues('Folder')"> instead of the array.

I'm not sure exactly what you want to print--do you want to print
the name of the item found in the folder? The title? The contents?

<dtml-in "objectValues(['Folder'])">
  <tr>
    <td><dtml-var title_or_id></td>
  </tr>
</dtml-in>

This will print the title, or failing that, the ID.

The Zope book is an excellent reference for questions like this.

-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington