Copied to clipboard

Flag this post as spam?

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


  • Rachel Skuse 88 posts 118 karma points
    Feb 03, 2010 @ 12:24
    Rachel Skuse
    0

    Listing sub pages on a sub page

    Hi,

    I have the following navigation structure:

    • RECIPES
      • Recipe 1
      • Recipe 2
      • Recipe 3
      • Recipe 4

    I would like to be able to list the recipes on each recipe page so that the user can easily navigate from one to another.

    I understand listing sub pages from a current page but can anyone point me in the direction of how to list sub pages on a sub page!

    Many thanks,

    Rachel

     

  • Tommy Poulsen 514 posts 708 karma points
    Feb 03, 2010 @ 12:39
    Tommy Poulsen
    0

    Hi Rachel

    To list immediate child nodes you do something like this:

    <xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'recipe']"/>

    To go further down the content tree you have to extend the $curentpage/node query to include more, e.g. by adding more specifiers:

    <xsl:for-each select="$currentPage/node [@nodeTypeAlias = 'recipes']/node [@nodeTypeAlias = 'recipe']
    "/>

    To include subchilds in any subpage you could do:

    <xsl:for-each select="$currentPage/descendant::node [@nodeTypeAlias = 'recipe']"/>

     

    Hope this helped

    >Tommy

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Feb 03, 2010 @ 12:39
    Dirk De Grave
    0

    Rachel,

    <xsl:for-each select="$currentPage/parent::node/node">...</xls:for-each>

    should get you all subpages (Recipe x) from a subpage.

    A great wiki page on xpath axis can be found here.

     

    Hope this helps.

    Regards,

    /Dirk

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 03, 2010 @ 12:43
    Thomas Höhler
    0

    depends on what you want to achieve. If you want to output a nested list use something like that:

    <ul>
    <xsl:for-each select="$currentPage/node">
    <li>
    <xsl:value-of select="@nodeName"/>
    <xsl:if test="count(node) &gt; 0">
    <ul>
    <xsl:for-each select="node">
    <li>
    <xsl:value-of select="@nodeName"/>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </li>
    </xsl:for-each>
    </ul>

    Take a look into Doug's great introductions to xslt :

    http://blog.percipientstudios.com/2009/4/11/anatomy-of-an-umbraco-xslt-file.aspx

    http://blog.percipientstudios.com/2009/5/5/your-first-umbraco-xslt-macro.aspx

    hth, Thomas

     

  • Rachel Skuse 88 posts 118 karma points
    Feb 03, 2010 @ 12:50
    Rachel Skuse
    0

    Thanks for all your speedy responses.

    The code Dirk provided was exactly what I needed

    <xsl:for-each select="$currentPage/parent::node/node">

    and the Wiki page is a great resource, I'll also be reading up on Doug's introductions to xslt.

    Many thanks,

    Rachel

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies