[Zope-dev] Looping through a folder's contents...

David Trudgett dkt@registriesltd.com.au
Sun, 20 Aug 2000 20:09:41 -1000


At 2000-08-20 23:06 -0700, jiva@devware.com wrote:

>I would like to loop through the contents of a folder, and the
>contents of the subfolders of that folder.  I know I can do this to a
>singular level by doing something like:
>
><dtml-in "subfolder.objectValues('Folder')">
><dtml-var title>
></dtml-in>
>
>Should give me a list of the titles of all the subfolders of the
>folder called "subfolder".  So, once I get there, how do I loop
>through the subobjects of each of those folders?
>
>In other words, I have a subfolder inside of the folder called
>"subfolder" and I want to see the contents of that folder.  How do I
>do it?
>--

I've used code similar to the following in an external method before:

thisitem = self.getFirstChild()
while thisitem is not None:
     if thisitem.meta_type == 'DTML Document':
         ...
     thisitem = thisitem.getNextSibling()


I haven't tried to do it in DTML.

David Trudgett