[Zope] Fetching the title of object whose id is passed in query string

John Q Wankah wankah@wank.com
Wed, 28 Nov 2001 21:35:27 -0500


I'm working on my first Zope project, an on-line photo galley, now
located at http://localhost:8080/gallery/ . The image objects are stored
in a subfolder called "imgs". The page at the above URL has a nav bar
with links that have the id of the image object to display in a query
string, like so: http://localhost:8080/gallery/?imgID=doorway. What I
want to do is display below the image the title of the image object
whose id is passed in the query string, sort of like a caption. For some
reason, though, I can't figure out how to ask for the image object's
title directly. What I'm doing now (and which works, but is ugly), is
this:

<dtml-if imgID>
  <dtml-in expr="imgs.objectValues()">
    <dtml-if "imgID==_['id']">
      <IMG SRC="imgs/<dtml-var imgID>" width=<dtml-var width>
height=<dtml-var height>>
      <P align="center"><dtml-var title></P>
    </dtml-if>
  </dtml-in>
</dtml-if>

How do I just do something like <dtml-var
expr="imgs.title_or_id(imgID)"> (or something like that) and make it
work?

TIA, Zope masters!

--Ben