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
Hello,
I have horixzontal menu & its child elements like this ....
element1
>c1element1
>>c1c1element1
>>c1c2element1
>c2element1
>>c2c1element1
>>c2c2element1
element2
element3
Lets say i apply role based protection to element named "c1element1"
then my horizontal menu becomes something like this....
>>c2element1
>>>c2c1element1
>>>c2c2element1
>element2
>element3
my xslt which generates horizontal menu is ....
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><!-- update this variable on how deep your site map should be --><xsl:variable name="maxLevelForSitemap" select="4"/><xsl:template match="/"><xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/> </xsl:call-template></xsl:template><xsl:template name="drawNodes"> <xsl:param name="parent"/> <!--xsl:copy-of select="$parent"/--> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"> <div id="myslidemenu" class="jqueryslidemenu"> <ul> <xsl:for-each select="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]"> <xsl:if test="name(.) != 'otherTemplates'"> <li> <xsl:if test="@id = $currentPage/@id"> <a href="{umbraco.library:NiceUrl(@id)}" class="current"><xsl:value-of select="@nodeName"/></a> </xsl:if> <xsl:if test="@id != $currentPage/@id"> <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> </xsl:if> <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-template name="drawNodes2"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </li> </xsl:if> </xsl:for-each> </ul> </div> </xsl:if> </xsl:template> <xsl:template name="drawNodes2"> <xsl:param name="parent"/> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"> <ul> <xsl:for-each select="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]"> <li> <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) < 1"> <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> </xsl:if> <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:if test="name(.)= 'PublicationsPage'"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </xsl:if> <xsl:if test="name(.) != 'PublicationsPage'"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> >> </a> <ul> <xsl:call-template name="drawNodes3"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </ul> </xsl:if> </xsl:if> </li> </xsl:for-each> </ul> </xsl:if> </xsl:template> <xsl:template name="drawNodes3"> <xsl:param name="parent"/> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"> <xsl:for-each select="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]"> <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-template name="drawNodes2"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </xsl:if> </xsl:template> </xsl:stylesheet>
how to achive proper horizontal menu even after applying public access protection
Hi,
You could try using the umbraco Library HasAccess around your loop.
<xsl:if test="umbraco.library:HasAccess(@id,@path)"> <xsl:for-eachselect="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]"> <li><ahref="{umbraco.library:NiceUrl(@id)}"><xsl:value-ofselect="@nodeName"/></a> <xsl:iftest="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-templatename="drawNodes2"> <xsl:with-paramname="parent"select="."/> </xsl:call-template> </xsl:if> </li> </xsl:for-each></xsl:if>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
problem in horizontal menu while applying public access protection
Hello,
I have horixzontal menu & its child elements like this ....
element1
>c1element1
>>c1c1element1
>>c1c2element1
>c2element1
>>c2c1element1
>>c2c2element1
element2
element3
Lets say i apply role based protection to element named "c1element1"
then my horizontal menu becomes something like this....
element1
>c1element1
>>c2element1
>>>c2c1element1
>>>c2c2element1
>element2
>element3
my xslt which generates horizontal menu is ....
how to achive proper horizontal menu even after applying public access protection
Hi,
You could try using the umbraco Library HasAccess around your loop.
is working on a reply...