[Zope] throwing exceptions when <img src=...> does not exist
Lee
lee.reilly@ntlworld.com
Mon, 19 Feb 2001 23:29:17 +0000
hi,
i have a little problem re: img and dtml-try tags:
there are images stored on an external server - these are named after
student's universtity usernames e.g. lreilly.gif. represents moi, lee
reilly. the problem is that it is not guaranteed that such an image is
stored for *every* student so i want to do something like...
<dtml-try>
<img src="d:\<dtml-var uname>.gif" width="240" height="180">
<dtml-except>
<img src="d:\dilbert.gif" width="240" height="180">
</dtml-try>
i.e. if the student gif exists display it otherwise display the file
dilbert.gif.
if the files were stored on zope then modifying the <img> tags to plain
<dtml-var uname> would work fine except that
(i) they're not stored on my server
(ii) <dtml-var uname> would display the username and not the image
(id=username) - i think this can be overcome though.
is there anyway to adapt the above code to actually *throw* an exception
when the image is not located. the results of the above code are as
follows:
if the files exist => it is displayed
if the file doesn't exist => nothing is displayed
anybody have any thoughts / advice?
cheers,
lee
--
Lee Reilly
mailto:lee.reilly@ntlworld.com
http://www.footkick.co.uk