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

Danny William Adair danny@adair.net
Thu, 29 Nov 2001 16:44:50 +1300


On Thursday 29 November 2001 15:35, John Q Wankah wrote:
> 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?



<dtml-var "imgs[imgID].title_or_id">


hth,
Danny


>
> TIA, Zope masters!
>
> --Ben
>
> _______________________________________________
> 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 )