[Zope] easier way with zpt

David Bear David.Bear at asu.edu
Tue Sep 19 20:24:33 EDT 2006


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:

<span tal:define="slot1 container/getimageR1" > 
  <!-- slot one item -->
  <span tal:define="global s1 python:'random1/'+slot1.getId()"></span>
</span>

in order to get the object to have the full url. 

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

-- 
David Bear
phone: 	602-496-0424
fax: 	602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"


More information about the Zope mailing list