I have a navigation menu for my website, which is generated by the pages/structure of the website.
I have this working however i have a yes/no property set in the document types to say if the page should be shown in the menu or not, however i cannot figure out how to do this. The alias for the property is called "showInNav".
Can anyone help me? I have no idea using XSLT. XSLT shown below....
Hi Duffman and welcome to the forum and the world of Umbraco :-)
I think that the above example seems to be a bit overkill of what you are trying to do.
I would recommend you have a look at the predefined XSLT navigation snippet, which can be found from the dropdown list, once you create a new XSLT file in Umbraco.
It should give you what you want I think.
When you want to show/hide pages I would urge you to rename your alias from "showInNav" to "umbracoNaviHide", which you can see is also what is being tested in the mentioned predefined XSLT snippet. It will make your life a bit more easy when working with umbraco.
XSLT and document properties
Hi,
I have a navigation menu for my website, which is generated by the pages/structure of the website.
I have this working however i have a yes/no property set in the document types to say if the page should be shown in the menu or not, however i cannot figure out how to do this. The alias for the property is called "showInNav".
Can anyone help me? I have no idea using XSLT. XSLT shown below....
Thanks.
<ul id="navmenu">
<xsl:for-each select ="$currentPage/ancestor-or-self::node[@level ='1']/descendant::node">
<xsl:if test="not (contains(current()/@nodeName,'News'))">
<xsl:if test="@level = 2">
<xsl:if test="count(child::node) > 0">
<li>
<xsl:if test ="$currentPage/parent::node/@id = current()/@id">
</xsl:if>
<a href="{umbraco.library:NiceUrl(current()/@id)}">
<xsl:value-of select="current()/@nodeName"/></a>
<ul>
<xsl:for-each select="current()/node">
<li>
<xsl:if test ="$currentPage/self::node/@id = current()/@id">
</xsl:if>
<a href="{umbraco.library:NiceUrl(current()/@id)}">
<xsl:value-of select="current()/@nodeName"/></a>
<ul>
<li><a href="#">test</a></li>
</ul>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="count(child::node) = 0">
<li>
<xsl:if test ="$currentPage/self::node/@id = current()/@id">
<xsl:attribute name="class" >selected</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(current()/@id)}">
<xsl:value-of select="current()/@nodeName"/></a>
</li>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
Hi Duffman and welcome to the forum and the world of Umbraco :-)
I think that the above example seems to be a bit overkill of what you are trying to do.
I would recommend you have a look at the predefined XSLT navigation snippet, which can be found from the dropdown list, once you create a new XSLT file in Umbraco.
It should give you what you want I think.
When you want to show/hide pages I would urge you to rename your alias from "showInNav" to "umbracoNaviHide", which you can see is also what is being tested in the mentioned predefined XSLT snippet. It will make your life a bit more easy when working with umbraco.
Hope this helps a bit?
/Jan
Duffman,
http://our.umbraco.org/projects/website-utilities/cogworks-flexible-navigation is your friend, navigation package with documentation that does obey hide from nav.
Regards
Ismail
is working on a reply...