Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I am using version 4.5.2 and faced with a little problem. Probably it is quite easy but so far could not find any solution on umbraco forum.
I have such structure
- Homepage - Gallery - Contact
- Homepage
- Gallery
- Contact
What I need to display homepage node in navigation with gallery and contact. Now only gallery and contact nodes are displayed
and here is my xslt
<xsl:variable name="level" select="1"/><xsl:template match="/"><ul><xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li></xsl:for-each></ul></xsl:template>
thanx
Not tested but this should work
<xsl:variable name="level" select="1"/> <xsl:template match="/"> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="/"> <xsl:value-of select="$currentPage/ancestor-or-self::*/@nodeName"/> </a> </li> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:template>
Try soething like this:
Snippet
<xsl:variable name="level" select="1"/> <xsl:template match="/"> <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::* [@level = $level]"/> <ul> <li> <a href="{umbraco.library:NiceUrl($rootNode/@id)}"> <xsl:value-of select="$rootNode/@nodeName"/> </a> </li> <xsl:for-each select="$rootNode/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:template>
hth, Thomas
Adjusted code for my solution (or use Thomas's code)
I had the 'Home' node in the loop by mistake
<xsl:variable name="level" select="1"/> <xsl:template match="/"> <ul> <li> <a href="/"> <xsl:value-of select="$currentPage/ancestor-or-self::*/@nodeName"/> </a> </li> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:template>
Rich
Thanks Rich and Thomas for valuable help.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to add root node to navigation
Hi all,
I am using version 4.5.2 and faced with a little problem. Probably it is quite easy but so far could not find any solution on umbraco forum.
I have such structure
- Homepage
- Gallery
- Contact
What I need to display homepage node in navigation with gallery and contact. Now only gallery and contact nodes are displayed
and here is my xslt
thanx
Not tested but this should work
Try soething like this:
Snippet
hth, Thomas
Adjusted code for my solution (or use Thomas's code)
I had the 'Home' node in the loop by mistake
Rich
Thanks Rich and Thomas for valuable help.
is working on a reply...