[Zope] easier way with zpt

Bernd Dorn zope-mailinglist at mopa.at
Wed Sep 20 01:05:00 EDT 2006


On 20.09.2006, at 02:24, David Bear wrote:

> 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>


tal:attributes="src slot1/absolute_url"



>
> 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"
> _______________________________________________
> 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