[ZPT] dynamic navigation menus
Wed, 31 Jul 2002 11:07:53 -0500
> From: Chris Withers [mailto:firstname.lastname@example.org]
> The rest, well, I'm afraid I didn't have tiem to read your whole
> post, any chance you could ask seperate, smaller questions?
One of my goals with the dynamic navigation is to distinguish selected from
unselected menu choices.
I have this kind of structure:
index_html (Page Template)
master_html (Page Template)
Everything that isn't a Page Template or Script is a Folder.
Suppose the user navigates to section a; e.g.,
Since that folder doesn't have an index_html, Acquisition means the user
will get the one in navtest. This page, in turn, just uses the whole page
macro defined in master_html:
The relevant snippet from there that renders the top-level tabbed navigation
looks like this:
<td tal:attributes="class python:test(container.select_this(section),
tal:attributes="href python:'content/%s' % (section.getId())"
<td width="24"> </td>
The select_this() function looks like this:
# Parameters: item
# Return boolean indicating whether the specified item should be
# displayed as selected.
current = context
while current != container:
if item == current:
current = current.getParentNode()
However, when the page is rendered and I click on section a, that tab
doesn't not have the class="tab_select" style, but the "tab_unselect" style.
I'm not sure what I'm doing wrong. I've been using Python for over a year,
but I'm relatively new to Zope and brand new to ZPT, so I'm sure I'm making
some conceptual mistakes.
I'll continue trying to reclarify my question as I learn more.