Copied to clipboard

Flag this post as spam?

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


  • Colin Watson 17 posts 47 karma points
    Apr 29, 2013 @ 16:38
    Colin Watson
    0

    xslt for 3 level dropdown menu

    Hi, Im new to Umbraco and this forum. Can anybody give me the xslt code for a 3 level menu like the below or point me in the right direction where I can find it. Or should I be using Superfish instead?

    Thanks in advance.

    Colin Watson


    <ul class="menuH decor1">
    <li><a href="projects.html" class="arrow">Projects</a>
                  <ul>
                    <li><a href="projects.html" class="arrow">Residenial</a>
                      <ul>
                        <li><a>1</a></li>
                        <li><a>2</a></li>
                      </ul>
                    </li>
                 </ul>
            </li>
    <li><a href="#2" class="arrow">Contact us</a>
                  <ul>
                    <li><a class="arrow">Item 1</a></li>
                    <li><a class="arrow">Item 2</a></li>
                  </ul>
                </li>
    </ul>

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 29, 2013 @ 21:40
    Dennis Aaen
    0

    Hi Colin,

    I will try to help you or at least point you in the right direction.


    <xsl:template match="/">

    <xsl:variable name="level" select="2"/>
    <xsl:variable name="dropDown" select="3"/>

    <!-- The fun starts here -->
    <ul class="menuH decor1">
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li class="arrow">
        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>  
         <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">    
           <ul>
                <xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
                      <li class="arrow">
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </li>
                   </xsl:for-each>        
           </ul>
         </xsl:if>
      </li>
    </xsl:for-each>
    </ul>
    </xsl:template>

    This should list level two nodes and if the level two nodes have any children these will be printed. You can change which levels of that should be printed by change these two lines.

    <xsl:variable name="level" select="2"/>
    <xsl:variable name="dropDown" select="3"/>

    /Dennis

  • Colin Watson 17 posts 47 karma points
    Apr 30, 2013 @ 12:37
    Colin Watson
    0

    Dennis thank you. I'll try this and get back to you.

     

    Best regards

     

    Colin

Please Sign in or register to post replies

Write your reply to:

Draft