[Zope] Dynamically Accessing Subfolders

Geir B Hansen geirh@funcom.com
Wed, 20 Oct 1999 09:49:48 +0200


> >
> >Here's a snippet of code that will do what you want:
> >
> >         <dtml-with A>
> >         <dtml-in "objectValues(['Folder'])">
> >           <dtml-with sequence-item>
> >            <dtml-var myName><BR>
> >           </dtml-with>
> >         </dtml-in>
> >         </dtml-in>
>
> This works like a charm.  Thanks.  Now here's a slight complication.
I
> want to iterate over the folders in a particular order.  The order
isn't
> based on the name or id of the folder, rather it would probably be
based on
> a particular property value.  For example, I might have three sub
folders
> A, B, C but I might want to iterate over the collection in the order
B, A,
> C.  I could fudge things by naming the folders in a particular sort
order
> but I would rather not go that route if there is an alternative.


If you're not going to have a lot of folders, you could manually assign
them a property called 'priority' or something..
Then sort by it like this:
        <dtml-in "objectValues(['Folder'])" sort=priority>

slightly cumbersome, but as far as i know, the only way to prioritize
things without sorting by any of the attributes the folders aready have.

------------------------------------------------
          Geir B Hansen
      geirh@funcom.com
Web-designer / Graphic artist
          Funcom Oslo
------------------------------------------------