[Zope] Checking if an image exists/simple question

Tres Seaver tseaver@palladion.com
Wed, 09 Feb 2000 20:44:22 -0600


"H.G.J. van der Linde" <linde@fsw.leidenuniv.nl> wrote:

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

Stack your namespaces manually::

 <dtml-with psychologie>
  <dtml-with mwfoto>
    <dtml-if "_.has_key( mwid )" >
     <dtml-var "_[ mwid ].tag()">
   <dtml-else>
     <dtml-var "anotherveryinterestingpicture.tag()">
   </dtml-if>
  </dtml-with>
 </dtml-with>

-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com