[Zope] looping over plone folders

Duncan McGreggor cms at adytumsolutions.com
Tue Sep 23 11:18:44 EDT 2003


Mitch Pirtle wrote:

> Hi list,
> 
> Another newbie-ish question, looked in the FAQ but couldn't find an
> example that was clear enough...
> 
> I'm recreating the navbar in a plone portal by hand, looping over the
> plone folders in the root folder of the plone site.  Ok, that's what I
> *want* to do, and need help from a zenmaster on how to do it within
> plone  :^)  The reason for this is that I'd like it to be
> dynamically-generated, based on the folders created; and hope to have a
> javascript-based dynamic menu populated by the objects within those root
> folders.  So far, when I use examples of looping (via ZPT
> documentation), Plone throws a security error and refuses to cooperate.
> 
> So I suppose the two questions are:
> 
> 1) How do you do this in Plone?
> 
> 2) Is there a better approach?

You might want to try using the ZCatalog (portal_catalog). Check out the 
news_slot (portal_skins/plone_templates/ui_slots/news_slot) in Plone for 
an example. The reason that I suggest the catalog is that you will then 
be able to sort on any indexed and sortable field. So, if you wanted to 
add a property to your plone folders called "display_order" (if you do 
this, consider making your own product/content type with all the custom 
properties you will want), you could place them as you like. Also, you 
can only return meta_type "Plone Folder" and that will prevent other 
unwanteds from showing up.

duncan




More information about the Zope mailing list