[Zope] Problem creating navigation bar

Loren Stafford lstafford@icompression.com
Wed, 13 Oct 1999 14:36:13 -0700


I haven't seen any way to avoid special handling of the root folder. In
http://www.zope.org/Members/lstaffor/Breadcrumbs I use
expr="PARENTS[0]==PARENTS[-1]" to detect the root folder. You might also use
PARENTS.len.

HTH
-- Loren

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of David
> C. Morrill
> Sent: Wednesday, October 13, 1999 13:56
> To: zope@zope.org
> Subject: [Zope] Problem creating navigation bar
>
>
> This has probably already been covered many times before, but my
> scan of the
> mailing list didn't turn up anything, so here it comes again...
>
> I want to build a navigation bar for a folder with each
> sub-folder having a
> certain property (e.g. 'isMenu') defined creating a link in the nav bar
> (i.e. sub-folders without the 'isMenu' property being defined
> should not be
> in the nav bar). Seems pretty simple so far.
>
> When a sub-folder is selected, I want it to display the same nav
> bar as the
> parent folder to allow navigation within this section of the site.
>
> The problem is that the nav bar for the sub-folders do not show
> any items at
> all (because their PARENTS[0] is not the same as for the parent folder).
> I've tried a lot of different things (too numerous to list here),
> but in all
> cases the acquisition logic defeated my attempts to solve it.
>
> I finally got it to work by using the following:
>
> <dtml-if "PARENTS[0].id == 'rootFolder'">
>   <dtml-call "REQUEST.set('root',PARENTS[0])">
> <dtml-else>
>   <dtml-call "REQUEST.set('root',PARENTS[1])">
> </dtml-if>
> <dtml-in "root.objectValues(['Folder'])">
>   <dtml-with sequence-item only>
>     <dtml-if "_.has_key('isMenu')">
>       ...<dtml-var id>...
>     </dtml-if>
>   </dtml-with>
> </dtml-in>
>
> The thing I don't like is having to test explicitly for the name
> of the root
> folder in the top line, since it prevents me from using the same DTML in
> some other part of the site. Does someone have a suggestion for a
> better way
> of doing this whole thing?
>
> Dave Morrill
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (Related lists - please, no cross posts or HTML encoding!
>
> To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>