[Zope] Easy way to display a random image in ZPT
Dragos Chirila
d.chirila at finsiel.ro
Fri Mar 19 04:17:29 EST 2004
Hi
Try this:
<img tal:define="rid python:whrandom.choice(here.images.objectIds())"
tal:attributes="src string:/images/${rid}">
This code works for a folder images in the ROOT and page template in the
ROOT. You can adapt it of course.
Dragos
> Michael Fox wrote:
> > Hi *,
> >
> > What's the easiest way to do the following DTML in ZPT?
> >
> > <img src="images/<dtml-var
> > expr="_.whrandom.choice(imgages.objectIds())">" />
>
> Easy:
>
> Save this DTML method as random_image:
> ----8<------8<------8<------8<------8<------8<--
> <img src="images/<dtml-var
> expr="_.whrandom.choice(imgages.objectIds())">" />
> ----8<------8<------8<------8<------8<------8<--
>
> and call this dtml method from your ZPT
>
> Regards,
>
> --
>
> Jaroslav Lukes
>
> --
> Tento e-mail nemu*ze obsahovat VIRY
> jelikoz nepocházi z virózního systému M$ Windows!
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
More information about the Zope
mailing list