[Zope] dtml syntax- check file existence
Sean Kelley
sean@horse101.com
Mon, 16 Dec 2002 19:20:43 -0800
Tried this out and it worked perfectly. Thanks.
Satheesh Babu wrote:
>try this (not tested):
>
><dtml-if "_.hasattr(photos2.aq_explicit, id+'.thumb.jpg')">
> has the image
><dtml-else>
> no image
></dtml-if>
>
>see this for more info: http://www.zopelabs.com/cookbook/1001104105
>
>S Babu
>http://vsbabu.org/
>
>On Sun, 2002-12-15 at 12:24, Sean Kelley wrote:
>
>
>>Hi
>>
>>I need help checking the existence of a file in a sub folder.
>>
>>
>>
>>if file(graphic) in sub folder exists
>>
>> display graphic
>>
>>else
>>
>> display message that there is no graphic
>>
>>
>>
>>The tricky part of this for me is that I have an ID for a graphic which
>>is available in a <dtml-in> loop
>>
>>so the graphic I am testing the existence of is named "id.thumb.jpg" and
>>is in a sub folder so if I do another dtml-in my ID is not available in
>>the second in loop.
>>
>>
>>
>>A partial failed example:
>>
>><dtml-in photos2>
>>
>> <dtml-if <dtml-var id>.thumb.jpg>
>> // I know this is not right
>>
>> <img src="/photos2/<dtml-var id>.thumb.jpg">
>> // and know id is not available at this level but not sure
>>how to pass it along.
>>
>> <dtml-else>
>>
>> no image
>>
>></dtml-in>
>>
>>
>>
>>
>>
>>_______________________________________________
>>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 )
>>
>>
>
>
>
>