Copied to clipboard

Flag this post as spam?

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


  • Tony 11 posts 31 karma points
    Jul 03, 2011 @ 20:00
    Tony
    0

    Sub Navigation Question...

    I am trying to show a basic sub navigation from 2 levels in on a top page...

    Example:

    Page (show sub nav here)
    - InnerPage (don't show this page)
    - - InnerInnerPage 1 (show this plus the following inner inner pages)
    - - InnerInnerPage 2
    - - InnerInnerPage 3

    Make sense?

    Here is the code I thought would work... but it doesn't. 

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

    Any ideas?
    Thanks,
    Tony

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 03, 2011 @ 20:51
    Dennis Aaen
    1

    Hi Tony,

    Have you looked for one of the predefined xslt snippets could do the job for you. Here I think of the one called List Subpages By Level.
    This XSLT file contains the following code:

    Variable indicates the level it should start. So maybe you could try to see if it can solve your problem..

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

    <
    xsl:template match="/">

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

    Hope this can help you.
    /Dennis

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jul 03, 2011 @ 21:27
    Kim Andersen
    0

    Hi Tony

    The reason why your subanvigation doesn't work is probably because the "InnerPage"-node's document type is not called InnerPage, or am I wrong?

    If you only want to show the navigation on the "Page"-node (using a for-each), you should be able to do this:

    <ul>
      <xsl:for-eachselect="$currentPage/*[@isDoc]/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li>
          <ahref="{umbraco.library:NiceUrl(@id)}">
            <xsl:value-ofselect="@nodeName"/>
          </a>
        </li>
      </xsl:for-each>
    </ul>

    You could use a xsl:apply-templates, sinstead of the for-each, but either way the result should be the same of course :)

    I guess that you've only inserted the macro on the page where the subnavigation should be shown.

    By the way, Dennis approach should work as well...

    /Kim A

  • Tony 11 posts 31 karma points
    Jul 04, 2011 @ 04:23
    Tony
    0

    Thanks for the replies!

    Ok so Kim... thank you for smacking me upside the head with that :) I totally was using the pages node name not doc type.  Not sure what I was thinking.

    Working great now.

    Thank you very much for helping me through that

    Tony

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jul 04, 2011 @ 19:12
    Kim Andersen
    0

    Hehe, you're more than welcome Tony. We all make mistakes once in a while right :)

    Glad it worked!

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft