[Zope] Testing if an image exists
Phil Harris
phil.harris@zope.co.uk
Wed, 23 May 2001 02:06:40 +0100
Michael,
Try something like, untested but looks good to me:
<dtml-with logos>
<dtml-if "_['logo'] in objectIds(['Image'])">
<dtml-var "_.getitem(_['logo'])">
</dtml-if>
</dtml-with>
hth
Phil
----- Original Message -----
From: "Michael Fox" <michael@centurysoftware.com.au>
To: <zope@zope.org>
Sent: Wednesday, May 23, 2001 2:01 AM
Subject: [Zope] Testing if an image exists
> Hello,
>
> I have a folder called 'logos' which contains several images, and a
session
> variable called 'logo'.
>
> I need to test if my session variable 'logo' matches the ID of an image
> object in my 'logos' folder.
>
> eg. I have an image in my 'logos' folder called 'mylogo' and the value of
my
> session variable is 'mylogo'.
>
> So far I've come up with this dtml, which doesn't seem to work..
>
> <dtml-with logos>
> <dtml-if _['logo']>
> <img src="logos/<dtml-var logo>">
> <dtml-else>
> no logo to display
> </dtml-if>
> </dtml-with>
>
> Has anyone had a similar need as above? can this be done?
>
> Regards,
>
> Michael Fox
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>