I've been looking for a navigation menu/sitemap for ZOPE. I've found a few but the output is not very well formed. Essentially every tool I've found outputs something similar to this: <div class="item" style="text-indent:35"> <!-- this is a parent element //--> Item </div> <div class="item" style="text-indent:65"> <!-- this is a child element //--> Child Item </div> The problem here is that the html structure doesn't intrisicly show any relationship between the two levels. The code just shows levels by using text-indent or margins or in some code table cells. What I'm looking for would display the sitemap/navigation in a format like this: <ul> <li>Item <ul> <li>Child Item</li> </ul> </li> </ul> This structure has the element relationship built in by design. Does anyone know of a product that does this or have a code snippet they could pass my way. Thanks. _________________________________________________________________
Hi Michael, Michael Havard wrote:
I've been looking for a navigation menu/sitemap for ZOPE. I've found a few but the output is not very well formed. ...
The problem here is that the html structure doesn't intrisicly show any relationship between the two levels. The code just shows levels by using text-indent or margins or in some code table cells. What I'm looking for would display the sitemap/navigation in a format like this:
<ul> <li>Item <ul> <li>Child Item</li> </ul> </li> </ul>
This structure has the element relationship built in by design. Does anyone know of a product that does this or have a code snippet they could pass my way.
i have looked for something like this myself, but havent found one ready zope product. The closest to this is probably MenuGenerator in the SF collective http://cvs.sourceforge.net/viewcvs.py/collective/MenuGenerator/ , but it is for CMF/Plone and not yet released. But perhaps you can get some ideas from it. Hth, Jochen
Jochen Knuth wrote:
Hi Michael,
Michael Havard wrote:
I've been looking for a navigation menu/sitemap for ZOPE. I've found a few but the output is not very well formed.
Have you had a try on NFG-nav? It works well, and give you a hierarchy of the menu-items. Best Regards Einar Næss Jensen
Einar Næss Jensen wrote:
Michael Havard wrote:
I've been looking for a navigation menu/sitemap for ZOPE. I've found a few but the output is not very well formed.
Have you had a try on NFG-nav? It works well, and give you a hierarchy of the menu-items.
google: lukesh dhtml menu zope plus my last question about sorting in python dynamically :o) Regards JL.
Michael Havard wrote:
I've been looking for a navigation menu/sitemap for ZOPE. I've found a few but the output is not very well formed.
Essentially every tool I've found outputs something similar to this:
<div class="item" style="text-indent:35"> <!-- this is a parent element //--> Item </div> <div class="item" style="text-indent:65"> <!-- this is a child element //--> Child Item </div>
The problem here is that the html structure doesn't intrisicly show any relationship between the two levels. The code just shows levels by using text-indent or margins or in some code table cells. What I'm looking for would display the sitemap/navigation in a format like this:
<ul> <li>Item <ul> <li>Child Item</li> </ul> </li> </ul>
This structure has the element relationship built in by design. Does anyone know of a product that does this or have a code snippet they could pass my way.
Here's something that I use for generation of a navigation tree. You can simplify it by removing the highlighting stuff and the styling stuff that interfaces with TransMenus (http://personal.archomai.org/transMenus.php). Some things specific to my code and probably not yours: - course: a previously defined value for the object the tree should start at. You could use 'root' or 'context' or something else. - equivalency test: mine is for Archetypes objects. You'll need some other testif you don't have UIDs. - children listing: mine is project-specific. You can probably use 'objectValues' or 'contentValues' - groupishness: again, mine is project-specific, an attribute on groupish types. You could use truthfullness of the children-listing as above. Also, I've previously posted several times a simpler recursive tree-walker that works similarly, but with less METAL magic. ZPT:: ... <ul id="collapsibleDemo"> <li tal:define="highlight python: course.UID()==here.UID()"> <span tal:attributes="class python:highlight and 'ccCurrentElt' or None"> <a href="." tal:attributes="href course/absolute_url"> <img src="site_icon.gif" tal:replace="structure python:path('here/%s' % course.getIcon(1))" tal:on-error="structure here/site_icon.gif" /></a> <a href="." tal:attributes="href course/absolute_url" tal:content="course/Title">Element</a> </span> <img tal:replace="structure here/transmenus/arrow.png" tal:condition="highlight" /> <ul tal:repeat="elt course/children"> <span metal:use-macro="template/macros/recursivetree" /> </ul> </li> </ul> ... <tal:macros tal:replace="nothing"> <metal:li metal:define-macro="recursivetree"> <li tal:define="highlight python: elt.UID()==here.UID()"> <span tal:attributes="class python:highlight and 'ccCurrentElt' or None"> <a href="." tal:attributes="href elt/absolute_url"> <img src="site_icon.gif" tal:replace="structure python:path('here/%s' % elt.getIcon(1))" tal:on-error="structure here/site_icon.gif" /></a> <a href="." tal:attributes="href elt/absolute_url" tal:content="elt/Title">Element</a> </span> <img tal:replace="structure here/transmenus/arrow.png" tal:condition="highlight" /> <tal:groupish tal:condition="exists:elt/aq_explicit/isGroup"> <ul class="collapsibleMenu" tal:condition="elt/children"> <tal:block tal:repeat="elt elt/children"> <span metal:use-macro="template/macros/recursivetree" /> </tal:block> </ul> </tal:groupish> </li> </metal:li> </tal:macros> -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
participants (5)
-
Einar Næss Jensen -
J. Cameron Cooper -
Jaroslav Lukesh -
Jochen Knuth -
Michael Havard