Submenu that displays the same subpages on all subpages below a document.
Hi.
When clicking on one of the pages, i want a submenu to display with all the subpages to the current page. And i want it to display the same subpages on all the subpages, no matter how far down in the levels i go. Like if i click on mypage2 or any of the following mypage6, 8 and 7 i want the other subpages that i mentioned to be shown.
what you will need here is some kind of 'anchor' or fixed startnode for your submenu(s). If you know for instance that your submenu should always start at nodes with level three you can do the following:
<xsl:variable name="subMenuRoot" select="$currentPage/ancestor-or-self::*[@isDoc and @level=3]" />
Or if you know that the submenu root will always be of a certain document type you can do:
<xsl:variable name="subMenuRoot" select="$currentPage/ancestor-or-self::*[@isDoc and @nodeTypeAlias='your-node-type-alias']" />
Once you got the root node it gets easy:
<xsl:for-each select="$subMenuRoot/descendant::*[@isDoc]"> //output the nodes, e.g. <a href="{umbraco.library:NiceUrl(./@id)}"> <xsl:value-of select="./@nodeName" /> </a> </xsl:for-each>
Submenu that displays the same subpages on all subpages below a document.
Hi.
When clicking on one of the pages, i want a submenu to display with all the subpages to the current page.
And i want it to display the same subpages on all the subpages, no matter how far down in the levels i go.
Like if i click on mypage2 or any of the following mypage6, 8 and 7 i want the other subpages that i mentioned to be shown.
Structure
- Mypage1
- Mypage2
- Mypage6
- Mypage8
- Mypage7
- Mypage3
- Mypage10
- Mypage11
I hope you guys can understand my example, if not, please tell me, and i will try to make another example :)
Thanks in advance! =)
Hi Malte,
what you will need here is some kind of 'anchor' or fixed startnode for your submenu(s). If you know for instance that your submenu should always start at nodes with level three you can do the following:
Or if you know that the submenu root will always be of a certain document type you can do:
<xsl:variable name="subMenuRoot" select="$currentPage/ancestor-or-self::*[@isDoc and @nodeTypeAlias='your-node-type-alias']" />
Once you got the root node it gets easy:
Hope that helps!
Sascha
Thank you very much Sascha!
It works like a charm :)
Great, glad you got it working! :)
is working on a reply...