Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • syn-rg 282 posts 425 karma points
    Jan 31, 2011 @ 07:09
    syn-rg
    0

    Side menu hide child node

    I'm trying to adjust my sideMenu.xslt

    I want to be able to hide certain doctypes and/or hide certain nodes from the navigation but keep the navigation open.

    I'm using umbracoNaviHide already to hide duplicates of the parent node in the child node list, but want the option to hide certain doctypes. But if I do use umbracoNaviHide it will hide the entire menu.

    So I've added a true/false data type to the following pages doctype (hideFromSideMenu). When this is clicked the navigation anchor needs to hide. But I can't get it to work.

    I'm trying to hide it with CSS display:none; which should work nicely.

    Can anyone help out?

    Cheers,
    JV

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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"
    exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
      
    <xsl:template match="/">
      <xsl:choose>
        <xsl:when test="string($currentPage/sideMenu) = '1'">
          <div id="level2_nav">
            <ul id="qm0" class="qmmc">
              <xsl:call-template name="drawNodes">
                <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::*[@level=2]"/>
              </xsl:call-template>
              <script type="text/javascript"> $(document).ready(function() { qm_create(0,true,0,500,'all',false,false,false,false); });</script>
            </ul>
          </div>
        </xsl:when>
      </xsl:choose>
    </xsl:template>


    <xsl:template name="drawNodes">
    <xsl:param name="parent"/>

    <xsl:for-each select="$parent/*
    [@isDoc][string(sideMenu) = '1' and (umbraco.library:IsProtected(@id,
    @path) = false() or umbraco.library:HasAccess(@id, @path) = true())]"
    >
    <li>
    <xsl:if test="count(./* [@isDoc][string(./sideMenu) = '1']) = 0 ">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
    </xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>
    </xsl:if>
      
    <xsl:if test="count(./* [@isDoc][string(./sideMenu) = '1']) &gt; 0">
    <a>
    <xsl:attribute name="class">qmparent</xsl:attribute>
    <!--xsl:value-of select="count(./* [@isDoc][@id = $currentPage/@id])" -->
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = @id ">
    <xsl:attribute name="class">qmactive qmpersistent</xsl:attribute>
    </xsl:if>
    <xsl:attribute name="href">
    <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
    </xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>

    <xsl:choose>
    <xsl:when test="./hideFromSideMenu != '1'">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
    </xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>
    </xsl:when>
    </xsl:choose>

    <ul>
    <xsl:choose>
    <xsl:when test="./umbracoNaviHide != '1'">
    <li>
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="umbraco.library:NiceUrl(@id)" />
    </xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:when>
    </xsl:choose>


      
    <xsl:call-template name="drawNodes">
    <xsl:with-param name="parent" select="."/>
    </xsl:call-template>
    </ul>
    </xsl:if>
      
    </li>
    </xsl:for-each>
    </xsl:template>


    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft