Hi *, I have a folder which contains a bunch of ZPT's and images, some of which share the same unique ID as a ZPT which a ".jpg" extension. ie. 1000 1000.jpg 1001 1002 1003 1004.jpg 1004 I have an index_html object which will render any ZPT in this directory and the matching image, if available. If there is no matching image I want to display an "image unavailable", but can't get this to work. <span tal:define="image string:${here/id}.jpg"> <span tal:replace="image"></span> <span tal:condition="not:python:here.objectIds(image)"> There are currently no items available. </span> </span> Regards, Michael Fox ^-^ Analyst/Programmer <`-`> ___ Century Software ' `' '. Tel +61 2 9460 1422 `. ` ' .'. Fax +61 2 9460 3098 ||.' '._/'.`.' www.CenturySoftware.com.au "" "
Michael Fox wrote:
Hi *,
I have a folder which contains a bunch of ZPT's and images, some of which share the same unique ID as a ZPT which a ".jpg" extension. ie.
1000 1000.jpg 1001 1002 1003 1004.jpg 1004
I have an index_html object which will render any ZPT in this directory and the matching image, if available.
If there is no matching image I want to display an "image unavailable", but can't get this to work.
<span tal:define="image string:${here/id}.jpg">
<span tal:replace="image"></span>
<span tal:condition="not:python:here.objectIds(image)"> There are currently no items available. </span>
</span>
Regards,
Michael Fox ^-^ Analyst/Programmer <`-`> ___ Century Software ' `' '. Tel +61 2 9460 1422 `. ` ' .'. Fax +61 2 9460 3098 ||.' '._/'.`.' www.CenturySoftware.com.au "" " _______________________________________________ Zope maillist - Zope@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 )
hi, try following, <span tal:define="image python:str(template.id + '.jpg')"> <img src="" tal:attributes="src image"> </span> harshad -- Harshad Behere ZeOmega (www.zeomega.com) Open Minds' Open Solutions 20/21,Rajalakshmi Plaza, South End Road, Basavanagudi Bangalore-560 004 India
On Tue, Jul 20, 2004 at 03:59:22PM +1000, Michael Fox wrote:
If there is no matching image I want to display an "image unavailable", but can't get this to work.
<span tal:define="image string:${here/id}.jpg">
<span tal:replace="image"></span>
<span tal:condition="not:python:here.objectIds(image)">
That can't work. objectIds() returns a list of IDs and takes no arguments. The simplest thing would be: <span tal:condition="python:image not in here.objectIds()" /> That could be problematically slow if there are a whole lot of objects in the folder. You could also try: <span tal:condition="python:not hasattr(here, image)" /> ... but that is only good if you know that objects with the image ID will not be acquired from elsewhere in the current context. -- Paul Winkler http://www.slinkp.com
In article <20040720172123.GB3198@slinkp.com> you write:
On Tue, Jul 20, 2004 at 03:59:22PM +1000, Michael Fox wrote:
If there is no matching image I want to display an "image unavailable", but can't get this to work.
<span tal:define="image string:${here/id}.jpg">
<span tal:replace="image"></span>
<span tal:condition="not:python:here.objectIds(image)">
That can't work. objectIds() returns a list of IDs and takes no arguments.
FYI objectIds() (and friends) can take a meta_type as an argument, to filter the results. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
participants (4)
-
Florent Guillaume -
harshad behere -
Michael Fox -
Paul Winkler