Creating Navigation which is not based on content node name.
Hi, im new to the whole xslt navigation creation, and i am simply wondering whether there is the ability to create a navigation off a spefied field name rather than the content node name??
i current have this
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">
Creating a navigation for the second tier of nodes in my content,
What i would like is the ability to have a navigation which is created from a property called "Section Name"
Hi dennis. i cant get this to work. I am creating the xlst file correct? ive tried both the templates "list subpages by level" and "list subpages from a changeable source" but it still isnt showing the property as a navigation.
Now I have the chance to test the code, and now I got it work as it should.
<xsl:variable name="level" select="2"/>
<xsl:template match="/">
<!-- The fun starts here --> <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="sectionName"/> </a> </li> </xsl:for-each> </ul>
</xsl:template>
The variable with the name level render in the example level 2 pages in the Umbraco content tree, If you want to render another level, you just have to set the value to for example 1 then the XSLT will render nodes from level 1 and so on.
Are youquiteonwhatstring (umbracoNaviHide)!= '1 ' does?
If not, I canjustquicklyexplainwhat it means. You have theoption to hidemenu itemsfrom yournavigation.You can do thisby create apropertyon yourdocument type.The data typeof the fieldmust be atrue /false, and thisshould have an alias of umbracoNaviHide.Sowhen the usertickin the checkbox themenu itemwillbehidingfromthe navigation.
Creating Navigation which is not based on content node name.
Hi, im new to the whole xslt navigation creation, and i am simply wondering whether there is the ability to create a navigation off a spefied field name rather than the content node name??
i current have this
Creating a navigation for the second tier of nodes in my content,
What i would like is the ability to have a navigation which is created from a property called "Section Name"
Is this possible??
Thanks!!
Hi newibe and welcome to the umbraco forum.
Yes it is certainly possible to print a different link text than just the content node name.
Something like this should, solve your question, if I am not completely wrong.
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">
<ul>
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="./sectionName" />
</a>
</li>
</ul>
</xsl:for-each>
Hope this can helps you.
/Dennis
Hi dennis. i cant get this to work. I am creating the xlst file correct? ive tried both the templates "list subpages by level" and "list subpages from a changeable source" but it still isnt showing the property as a navigation.
Thanks!
Newbie
Hi again,
I just saw I might have made a mistake. But I have not had the opportunity to test the code. And this is what is at top of my mind right now what could be wrong.
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">
<ul>
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="sectionName"/>
</a>
</li>
</ul>
</xsl:for-each>
I hope this will solve your problem.
/Dennis
Hi Newbie,
Now I have the chance to test the code, and now I got it work as it should.
The variable with the name level render in the example level 2 pages in the Umbraco content tree, If you want to render another level, you just have to set the value to for example 1 then the XSLT will render nodes from level 1 and so on.
I hope this will solve your question
/Dennis
Hi Dennis,
This is AMAZING!!
I think i totally understand what is happening here.
Thanks for the help!!
Starting to understand umbraco finally! :)
Newbie
Hi,
Good and hear that you got it to work finally.
Are you quite on what string (umbracoNaviHide)! = '1 ' does?
If not, I can just quickly explain what it means.
You have the option to hide menu items from your navigation. You can do this by create a property on your document type. The data type of the field must be a true / false, and this should have an alias of umbracoNaviHide. So when the user tick in the check box the menu item will be hiding from the navigation.
Hope this was useful information.
/Dennis
is working on a reply...