Instructional Technology Portfolio | Design and Development Tools | Lessons | Zope Lessons
Login   |  Résumé   |  IT Portfolio   |  Home

All about objectValues() function

The objectValues() function is a very useful function for design menu structures with. objectValues iterates a given object's content (a.k.a. folderish objects) and returns them as an object one by one.

For example, the following imbedded DTML code is used to list the hierarchy of these lessons:


<ul> <dtml-in expr="objectValues('Folder')"> <li><a href="<dtml-var absolute_url>"><dtml-var title></a></li> <ul> <dtml-in expr="objectValues()"> <li><a href="<dtml-var absolute_url>"><dtml-var title></a></li> </dtml-in> </ul> </dtml-in> </div></ul>

If you call objectValues() with no parameters, you will iterate through all items the object owns. You can limit the returned values by passing the meta-type of the object as a parameter, as done in the above example with "folder" Other salient values are "DTML Method" "Page Template"

You can also display multiple types of objects within the collection by passing a list of meta-types to the objectValues() function as demonstrated below:


objects = context.objectValues(['Folder','File','Image'])

mwlang@cybrains.net
Guest Login   |  Home