How to concatenate ID + string to check for object?
Hi, I've done my homework before posting, but can't find a way out: When adding articles to my intranet, if an icon exists (eg. if it's an article about Zope, I added the Zope icon to ZODB), I will display it in a corner; If no icon exists for this article, I'll display a default icon to avoid having an empty "IMG" box. I've tried multiple things, but none work. Here's the latest trial: //Zope complains that the first line below is NOK <dtml-if expr="<dtml-var id>+'.png'"> <img src="<dtml-var id>.png" border=0> //To check that concatenating both strings works <dtml-var id>.png <dtml-else> <img src="default_icon.png" border=0> <dtml-var id>.png </dtml-if> Any idea? Thx EvH.
This is really a question that would be better asked on the Zope mailing list - This list is intended for questions about developing Zope. None the less, what you have wrong is the line : <dtml-if expr="<dtml-var id>+'.png'"> You can't have the dtml-var embeded in the dtml-if statement. This might work a little better: <dtml-try> <dtml-let imageObject="_[getId()+'.png']"> <img src="<dtml-var getId>.png" border=0> </dtml-let> <dtml-except> <img src="default_icon.png" border=0> </dtml-try> But, as the image object has already been obtained, you could replace: <img src="<dtml-var getId>.png" border=0> with <dtml-var "imageObject.tag(border=0)"> Adrian... -- Adrian Hungate EMail: adrian@haqa.co.uk Web: http://www.haqa.co.uk ----- Original Message ----- From: "EvH" <edward_van_h@bigfoot.com> To: <zope-dev@zope.org> Sent: Saturday, July 20, 2002 1:15 PM Subject: [Zope-dev] How to concatenate ID + string to check for object?
Hi,
I've done my homework before posting, but can't find a way out: When adding articles to my intranet, if an icon exists (eg. if it's an article about Zope, I added the Zope icon to ZODB), I will display it in a corner; If no icon exists for this article, I'll display a default icon to avoid having an empty "IMG" box. I've tried multiple things, but none work. Here's the latest trial:
//Zope complains that the first line below is NOK <dtml-if expr="<dtml-var id>+'.png'"> <img src="<dtml-var id>.png" border=0> //To check that concatenating both strings works <dtml-var id>.png <dtml-else> <img src="default_icon.png" border=0> <dtml-var id>.png </dtml-if>
Any idea? Thx EvH.
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
participants (2)
-
Adrian Hungate -
EvH