[Zope] Another Zope question
Kevin Dangoor
kid@kendermedia.com
Sat, 6 May 2000 12:05:38 -0400
----- Original Message -----
From: "Nolan Darilek" <nolan_d@bigfoot.com>
To: <zope@zope.org>
Sent: Friday, May 05, 2000 9:35 PM
Subject: [Zope] Another Zope question
> And the (very broken and silly :) snippet of code is:
> <dtml-in menuitems>
> <dtml-if sequence-even>
> <a href="<dtml-var "_['sequence-item'].absolute_url()">">
> <dtml-else>
> <dtml-var sequence-item></a><br>
> </dtml-if>
> </dtml-in>
>
> So, of course, I'm calling absolute_url() on a string, when I'd like
> to be calling it on an object. The sequence-item is always an object
> ID when the index is even, so what I'd like is code which returns an
> object when passed its ID; something which assumes that the ID is
> either in the current folder, or is being acquired. So, something
> like:
Actually, you're almost there... You use _['sequence-item'] to look up a
variable called sequence-item in the namespace.... similarly, you can do
_[_['sequence-item']] to look up sequence-item, and then look up that string
in the namespace. So, _[_['sequence-item']].absolute_url() will give you the
URL of that object.
Kevin