[Zope] random object with properties

Dieter Maurer dieter@handshake.de
Tue, 21 Nov 2000 23:21:12 +0100 (CET)


Kevin Worth writes:
 > I'm trying to find/write a method that will choose a random image 
 > from a folder (easy, using the random how-to)  But I also want to 
 > display the caption for the image, which is a property of that image.
 > 
 > This method:
 > 
 > <dtml-var expr="_.whrandom.choice(objectValues('Photo'))">
 > <dtml-if caption><dtml-var caption></dtml-if>
 > 
 > presents me with a random photo, but no caption.
<dtml-let photo="_.whrandom.choice(objectValues('Photo'))">
<dtml-var photo>
<dtml-with photo>
  <dtml-if caption>....</dtml-if>
</dtml-with>



Dieter