I'm trying to build out a menu and need a little advice - my Xslt experience is a bit limited... What I've got so far is a multi-level nested menu that renders everything from level 2 to level 4 of the site, relative to the current page (ie, if the current page is level 2, the menu shows all level 2 pages, if it's level 3, it shows all pages at level 2 and all level 3 siblings of the current page).
I'd like to extend this to allow a node to have a property (say, topLevelMenuItem) which overrides the default menu layout - if topLevelMenuItem is true for the current page, the menu will only show the child nodes of the current page. The node with topLevelMenuItem set true essentially becomes a level 1 node, and the menu begins with its children.
Solved this one, if anyone is interested - absolutely a resutl of my lack of Xslt experience. I'm now using apply-templates rather than call-template, with the code block below controlling which menu tree is displayed:
Help with conditional menu
Hi
I'm trying to build out a menu and need a little advice - my Xslt experience is a bit limited... What I've got so far is a multi-level nested menu that renders everything from level 2 to level 4 of the site, relative to the current page (ie, if the current page is level 2, the menu shows all level 2 pages, if it's level 3, it shows all pages at level 2 and all level 3 siblings of the current page).
I'd like to extend this to allow a node to have a property (say, topLevelMenuItem) which overrides the default menu layout - if topLevelMenuItem is true for the current page, the menu will only show the child nodes of the current page. The node with topLevelMenuItem set true essentially becomes a level 1 node, and the menu begins with its children.
I'm setting two variables:
If subMenuTopLevelMenuNodes.Count() is zero, I render the full menu, which works fine. How would I handle the second scenario?
The menu template looks like this:
Any suggestions/direction/advice would be greatly appreciated...
ta
Nathan
Solved this one, if anyone is interested - absolutely a resutl of my lack of Xslt experience. I'm now using apply-templates rather than call-template, with the code block below controlling which menu tree is displayed:
<xsl:choose>
<xsl:when test="count($currentPage/ancestor-or-self::* [topLevelMenuItem = 1]) > 0">
<xsl:apply-templates select="$currentPage/ancestor-or-self::* [topLevelMenuItem = 1]/* [string(umbracoNaviHide) != '1' and @isDoc]" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$currentPage/ancestor-or-self::* [@level = 2]/* [string(umbracoNaviHide) != '1' and @isDoc]" />
</xsl:otherwise>
</xsl:choose>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.