[Zope] looking into folders for specific entries or add properties to fo lder on creation

Dieter Maurer dieter@handshake.de
Tue, 9 Apr 2002 22:04:33 +0200


Ria Marinussen writes:
 > In our zope-site we have two types of pages, contained in folders. I want
 > make the color of the generated URL dependant on the type of page that is in
 > the folder, while showing the link to the folder.
 > I use this code to generate the list of url's:
 >  <table>
 >   <dtml-in expr="objectValues('Folder')">
 >    <tr><td><a href="<dtml-var absolute_url>"> <dtml-var
 > title_or_id></a></td><tr>
 >   </dtml-in>
 >  </table>
 > 
 > I would like to be able to show the links in different colors depending on
 > the content(DTML-method) of the folder (every folder contains only one
 > DTML-method, folders are to be excluded, so I only have to check the name of
 > the DTML-method in the folder). 
 > Is it possible to look inside folders during the generating of this list of
 > URL's ?
Sure:

	<dtml-in expr="..." prefix=MyList>
	  <dtml-let folder="MyList_item"> <!-- this is the current folder
					       may be, there should be not "_"
	                                   -->
             <dtml-if "_.hasattr(folder.aq_explicit,'What you are lookin for')">
	         ....
             </dtml-if>
	  </dtml-let>
	</dtml-in>


Dieter