Mickael Remond wrote:
Ross Gardler wrote:
I missed the first part of this thread. Can you please explain why you
want to have items in your navigation tree with no label, it seems
kind of useless since no one will be able to see the navigation link
and therefore will not be able to use it.
I would like to avoid generating very long or very deep menu, that's why
I would like to hide menu elements. The links to those documents are not
included in the menu, but directly inside some of the documents managed
by the site.
So why include those document inside the site.xml file should you ask ?
Because, that's the only way I found to have the menu render properly.
If you load a file which is not defined in the site.xml, then the
complete menu is shown and not only the relevant sublevel.
OK, I get it.
Your approach is not the way to do this as it creates an additional
maintenance overhead in site.xml (there is no need to reference those
files there).
Furthermore, The skin expects to highlight the currently selected page
in the menu. If you have it hidden then the skin is not able to do that.
An illustration of the problem can for example be tested here:
http://www.process-one.net/en/projects/ejabberd/releases/index.html
This document content two sublevels documents that I would like to keep
hidden in the menu. However, if you click on one of them, the complete
menu for all the site is shown.
What do you expect the menu system to show when one of your hidden pages
is shown? I suppose the higher level menu item, but that seems a little
counter intuitive since the menu will highlight content that is not
actually vissible.
It would be possible to hack the skin so that the higher level menu is
displayed. The bit you are interested in is:
<xsl:choose>
<!-- Compare with extensions stripped -->
<xsl:when test="$node-path = $path-nofrag">
<xsl:choose>
<xsl:when test="contains(@href, '#')">
<xsl:call-template name="selected-anchor"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="selected"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains(@href, '#')">
<xsl:call-template name="unselected-anchor"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="unselected"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
in main/webapp/skins/common/xslt/html/book2menu.xsl
This code compares the node-path in the site.xml file with the path to
the current file. I guess you need to add a new <xsl:when> in there.
Something like this (note this is just an idea, I have not tested, nor
fully considered the implications):
<xsl:when test="starts-with($node-path, $path-nofrag)">
<xsl:choose>
<xsl:when test="contains(@href, '#')">
<xsl:call-template name="selected-anchor"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="selected"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
Let us know if you get anywhere, a patch would be welcome if you make
this work.
Ross