Copied to clipboard

Flag this post as spam?

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


  • pat 124 posts 346 karma points
    Jan 21, 2011 @ 12:55
    pat
    0

    how to list top level nodes on top navigation menu

    I'm very new to umbraco, have installed with runway, I am thinking to install CMs for each website.

    In my test site I have following Content

    Home

      --About Us

      -- Contact Us

    News

     --- News item1

     ---News Item2

    Faq

     ---- Topic A

          ---How to Cook A

          ---How to walk

     ----- Topic B

          ---- ABC

    KLM

      ---KLM 1

         --- KLM1.1

         ----KLM1.2

     

    Sorry for long post

    What ever page visitor in I need Only (Home, News,Faq,KLM) on Top navigation

    and then In left hand sub navigation when go to Faq see all sub pages under that .

    go to KLM1 see 2 pages under that so on

     

    in my top navigation it change everytime according to current page -

     <xsl:param name="currentPage"/>

        <!-- Input the documenttype you want here -->
        <xsl:variable name="level" select="1"/>

        <xsl:template match="/">

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

        </xsl:template>

    How to fix when I have diffrent folders on same level of Home page

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 21, 2011 @ 13:03
    Kim Andersen
    0

    Hi Pathini

    If you want to list the four top-nodes, you should change your for-each to this:

    <xsl:for-each select="$currentPage/ancestor-or-self::root/* [string(umbracoNaviHide) != '1' and @isDoc]">

    /Kim A

  • pat 124 posts 346 karma points
    Jan 21, 2011 @ 15:10
    pat
    0

    thanks root give me top level only

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 21, 2011 @ 15:18
    Kim Andersen
    0

    Great Pathini.

    Actually most of the Umbraco sites out there uses a different structure than you have got. By using one more level, most of the default XSLT templates in Umbraco works like a charm.

    A structure like this:

    Content
      - Home
        - About us
        - News
          - News 1
          - News 2
        - FAQ
          - Topic A
          - Topic B
        - Contact us

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft