Hi guys, Im a new user to this site and software but I like it a lot and need a litle help.
I need to create an XSLT loop which reads my page names, to create a navigation bar complete with text links. I have done that but I need to Ignore one of my document types as I dont want users to have the option to link directly to these pages. Does anyone have any idea on how i can accopmlish this?
I assume that you have created your navigation using the XSLT snippet in umbraco called "Navigation Prototype".
It only includes documents that have not been hidden from the navigation. So maybe your problem could be solved by adding the "umbracoNaviHide" property to your pages and then check those that you don't want in your navigation.
That's really all there is to it.
However if you want to check for a certain documenttype you should be able to do it like this
<ul> <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1' and data/@nodeTypeAlias != 'excludedDoctType']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="style">font-weight: bold;</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul>
after the test to see if the umbracoNaviHide property is 1 I have added the next condition, which check's that the current nodeTypeAlias is not the docType you want excluded.
Please notice this is written form the top of my head and I have not tested the code.
Thank you for the speedy reply, unfortunatly im not entirly sure how to incoporate that loop into my current code. If i were to post my XSLT file here would you be able to highlight where it should be inserted? That way i can read it, get to grips with it and hopefully learn from it?
Not to worry. i looked into the "umbracoNaviHid" Property and it worked, however the link to be missed out of the navigation was supposed to be displayed further down the page (using a separate macro call "display headlines") and changing that property removed it from both locations. However I got past this by changing the:-
XSLT If * And Not * Loop - help please?
Hi guys, Im a new user to this site and software but I like it a lot and need a litle help.
I need to create an XSLT loop which reads my page names, to create a navigation bar complete with text links. I have done that but I need to Ignore one of my document types as I dont want users to have the option to link directly to these pages. Does anyone have any idea on how i can accopmlish this?
Thanks
Hi Matthew and welcome to our :-)
I assume that you have created your navigation using the XSLT snippet in umbraco called "Navigation Prototype".
It only includes documents that have not been hidden from the navigation. So maybe your problem could be solved by adding the "umbracoNaviHide" property to your pages and then check those that you don't want in your navigation.
That's really all there is to it.
However if you want to check for a certain documenttype you should be able to do it like this
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1' and data/@nodeTypeAlias != 'excludedDoctType']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<!-- we're under the item - you can do your own styling here -->
<xsl:attribute name="style">font-weight: bold;</xsl:attribute>
</xsl:if>
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
after the test to see if the umbracoNaviHide property is 1 I have added the next condition, which check's that the current nodeTypeAlias is not the docType you want excluded.
Please notice this is written form the top of my head and I have not tested the code.
Hope this helps.
/Jan
Jan,
Thank you for the speedy reply, unfortunatly im not entirly sure how to incoporate that loop into my current code. If i were to post my XSLT file here would you be able to highlight where it should be inserted? That way i can read it, get to grips with it and hopefully learn from it?
Cheers
Jan,
Not to worry. i looked into the "umbracoNaviHid" Property and it worked, however the link to be missed out of the navigation was supposed to be displayed further down the page (using a separate macro call "display headlines") and changing that property removed it from both locations. However I got past this by changing the:-
"and string(data [@alias='umbracoNaviHide']) != '1']">"
value in the display headlines macro to: -
"and string(data [@alias='umbracoNaviHide']) != '0']">"
Thanks for the help
Matt
is working on a reply...