[Zope] Another Zope question

Nolan Darilek nolan_d@bigfoot.com
Fri, 05 May 2000 20:35:12 -0500


I'm making a few backend modifications to my Zope page so that
different content styles can be selected. I'm trying to create a
page-viewing mode which eliminates tables, graphics, JavaScript,
etc. from my pages, and adds in a few extre navigation buttons.

To help with this, I'm modifying my navigation bar system. Originally
I wanted to create menu methods on each page which output the actual
HTML of the links, but I'm changing this to a more abstract
system. I've created a menuitems property on each folder which I'd
like to have a sidebar attached to, and the standard_html_header loops
through this.

I'm running into a problem, though. The property in which I'm storing
the menu data is formatted like:

<relative ID of document being linked to>
<title for menu item>
. . .

and the code basically loops through this and inserts the data into
the anchor tags. (I plan to add sound to my page and would like to
allow folks the option of turning it off site-wide, so even though
this looks pointless, it makes sense. :)

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:

myResume = this().lookup("resume")

would return an object and allow me to call myResume.absolute_url().

Is there such a beast? And, if not, how difficult would it be to
write? Could this be done as a DTML method?

Thanks a bunch.