[Zope] easier way with zpt

Andrew Milton akm at theinternet.com.au
Wed Sep 20 01:00:11 EDT 2006


+-------[ David Bear ]----------------------
| I wanted to randomly pick a an image from an images folder and insert
| it into my page. So I created a python script the return a random
| selection from the images folder. 
| 
| Then, in my zpt I did
| 
| <span tal:define="global slot1 container/getimageR1" > 
|   <!-- slot one item -->
| </span>
| 
| Later in in the <img> tag I wanted to to do
| 
| <img tal:attributes="src slot1" >
| 
| however I found that slot1 was not giving me the full path to the
| images folder. So I went back and did this:

[snip]

| It just seems there should be a better way. Anyone have a suggestion?

Get your getimageR1 script to return randomImage.absolute_url(), instead of
the image itself?

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list