[Zope] Problem creating navigation bar
Loren Stafford
lstafford@icompression.com
Wed, 13 Oct 1999 16:34:54 -0700
OK, since I already went off half-cocked once, I might as well try it again.
Now I understand that the root folder for this method is not the Zope root.
To address the issue of reusing the method with a different "method root",
suppose the method "NavBar" were part of a Z Class (or perhaps the default
method of a Z Class object). Then it could have an instance constant "Root"
that could be assigned the right folder ID for every instance. The method
"NavBar" itself would be inherited from the Class, so any changes to the
class would always be reflected in all the instances.
Just an idea. Maybe not a good one. I've got Z Classes on the brain right
now.
-- 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 )
>