Checking if an image exists/simple question
Hi, We have a sql database with employee information. Every employee record has an MWID field. Photo's of the employees are stored in a Zope folder (mwfoto) where the id of every photo has MWID as its name. So we can display the photo like this: <img src="/psychologie/mwfoto/<dtml-var mwid>" This works fine. Now I want to check if a photo exists, and if not, display some other info. In some sort of Zope pseudocode: <dtml if exist(mwid)> showphoto <dtml else> showanotherveryinterestingpicture </dtml-if> How do I do this? Your help is very much appreciated, Henny van der Linde Leiden University linde@fsw.leidenuniv.nl
Hi, "H.G.J. van der Linde" wrote:
<dtml if exist(mwid)> showphoto <dtml else> showanotherveryinterestingpicture </dtml-if>
How do I do this?
Your help is very much appreciated,
<dtml-if mwid> <img src="/psychologie/mwfoto/<dtml-var mwid>"> <dtml-else> showanotherveryinterestingpicture </dtml-if> or you could try: <dtml-var mwid missing="Some default text"> ... Holger
Hi, I just did came across this today and found an answer.. I am calling a SQL database, getting back a variable "image_name" and checking to see if that name of that variable exists as an image. "image.merchants" are the folders I am keeping the images in... (nested) <dtml-if "_.hasattr(images.merchants, image_name)"> # if it exists <dtml-var "_.getattr(images.merchants, image_name)"></a> # display it <dtml-else> # otherwise Some other thing to do (I used a text link) </dtml-if> Hope this works for you... If anyone knows how to get the border to ="0" when getting back that image I would apprecitate it. JMA
From: "H.G.J. van der Linde" <linde@fsw.leidenuniv.nl> Date: Wed, 9 Feb 2000 18:48:22 +0100 To: "Zope mailing list" <zope@zope.org> Subject: [Zope] Checking if an image exists/simple question
Hi,
We have a sql database with employee information. Every employee record has an MWID field. Photo's of the employees are stored in a Zope folder (mwfoto) where the id of every photo has MWID as its name. So we can display the photo like this:
<img src="/psychologie/mwfoto/<dtml-var mwid>"
This works fine. Now I want to check if a photo exists, and if not, display some other info. In some sort of Zope pseudocode:
<dtml if exist(mwid)> showphoto <dtml else> showanotherveryinterestingpicture </dtml-if>
How do I do this?
Your help is very much appreciated,
Henny van der Linde Leiden University linde@fsw.leidenuniv.nl
_______________________________________________ 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 )
Try this: <dtml-var "_.getattr(images.merchants, image_name).tag(border=0)"></a> I'll be interested to know if it works... Chris
Hi,
I just did came across this today and found an answer..
I am calling a SQL database, getting back a variable "image_name" and checking to see if that name of that variable exists as an image.
"image.merchants" are the folders I am keeping the images in... (nested)
<dtml-if "_.hasattr(images.merchants, image_name)"> # if it exists <dtml-var "_.getattr(images.merchants, image_name)"></a> # display it <dtml-else> # otherwise Some other thing to do (I used a text link) </dtml-if>
Hope this works for you... If anyone knows how to get the border to ="0" when getting back that image I would apprecitate it.
Thanks. I will try this too. Now i'm using: <dtml-with psychologie> <dtml-with mwfoto> <dtml-with "_[_.str(orggroup)]"> <dtml-if "_.has_key(_.string.strip(mwid))"> <dtml-var "_[_.string.strip(mwid)].tag(align='right')"> <dtml-else> <dtml-var "geenfoto.tag(align='right')"> </dtml-if> </dtml-with> </dtml-with> </dtml-with> <dtml-var wie_is> This works too. The stripping thingies are necesary because SQL server 7 or the ODBC adapter fills out the field with blancs. Setting border to "0": <dtml-var "_[_.string.strip(mwid)].tag(border='0')"> Henny van der Linde Leiden University
participants (5)
-
Chris Withers -
H.G.J. van der Linde -
Henny van der Linde -
Holger Hoffmann -
J. Atwood