Copied to clipboard

Flag this post as spam?

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


  • Malte Baden Hansen 61 posts 158 karma points
    Aug 16, 2010 @ 20:00
    Malte Baden Hansen
    0

    Submenu that displays the same subpages on all subpages below a document.

    Hi.

    When clicking on one of the pages, i want a submenu to display with all the subpages to the current page.
    And i want it to display the same subpages on all the subpages, no matter how far down in the levels i go.
    Like if i click on mypage2 or any of the following mypage6, 8 and 7 i want the other subpages that i mentioned to be shown.

    Structure

    - Mypage1
    - Mypage2
       - Mypage6
          - Mypage8
       - Mypage7
    - Mypage3
       - Mypage10
       - Mypage11

    I hope you guys can understand my example, if not, please tell me, and i will try to make another example :)

    Thanks in advance! =)

  • Sascha Wolter 615 posts 1101 karma points
    Aug 16, 2010 @ 21:25
    Sascha Wolter
    0

    Hi Malte,

    what you will need here is some kind of 'anchor' or fixed startnode for your submenu(s). If you know for instance that your submenu should always start at nodes with level three you can do the following:

    <xsl:variable name="subMenuRoot" select="$currentPage/ancestor-or-self::*[@isDoc and @level=3]" />

    Or if you know that the submenu root will always be of a certain document type you can do:

    <xsl:variable name="subMenuRoot" select="$currentPage/ancestor-or-self::*[@isDoc and @nodeTypeAlias='your-node-type-alias']" />

    Once you got the root node it gets easy:

    <xsl:for-each select="$subMenuRoot/descendant::*[@isDoc]">
      //output the nodes, e.g.
      <a href="{umbraco.library:NiceUrl(./@id)}">
        <xsl:value-of select="./@nodeName" />
      </a>
    </xsl:for-each>

    Hope that helps!
    Sascha

  • Malte Baden Hansen 61 posts 158 karma points
    Aug 17, 2010 @ 00:09
    Malte Baden Hansen
    0

    Thank you very much Sascha!

    It works like a charm :)

  • Sascha Wolter 615 posts 1101 karma points
    Aug 17, 2010 @ 00:27
    Sascha Wolter
    0

    Great, glad you got it working! :)

Please Sign in or register to post replies

Write your reply to:

Draft