Copied to clipboard

Flag this post as spam?

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


  • Casper Søgaard 6 posts 26 karma points
    Oct 26, 2011 @ 15:33
    Casper Søgaard
    0

    Getting nodes from a specific folder

    Hi all,

    I'm quite new to umbraco and esspecially xslt. 

    I've this structure:

    Home
    -> Company
    -> Products
    ->-> Product 1
    ->-> Product 2
    -> News

     

    I want to create a menu that only contains the nodes within the Products folder.

    Thanks for helping!

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 26, 2011 @ 16:49
    Dirk De Grave
    0

    Hi,

    Bit sad there's no starting point, so you've got no xslt so far...

    Anyway, start with following code snippet:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1234)/* [@isDoc]">
    <a href="{umbraco.library:NiceUrl(@id)}">@nodeName</a>
    </xsl:for-each>

    this will iterate all child nodes of node with id = 1234 (Of course, change that to reflect the id of your 'Products' node)

    And to make it a bit more generic, you could use a parameter to pass to your xslt and use that parameter value instead of the hardcoded value 1234

     

    Hope this helps.

    Cheers,

    /Dirk

     

     

     

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 26, 2011 @ 16:52
    Dirk De Grave
    0

    And a good starting point to learn more about xslt in umbraco: http://our.umbraco.org/wiki/reference/xslt

     

    Cheers,

    /Dirk

  • Casper Søgaard 6 posts 26 karma points
    Oct 26, 2011 @ 17:06
    Casper Søgaard
    0

    Thanks.

    Added some:

    <xsl:for-each select="umbraco.library:GetXmlNodeById(1161)/* [@isDoc]">
        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a><br/>
      </xsl:for-each>
  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Oct 26, 2011 @ 17:07
    Dirk De Grave
    0

    Ha, good catch, will teach me to check my answers more thoroughly.

     

    Cheers,

    /Dirk

  • Casper Søgaard 6 posts 26 karma points
    Oct 26, 2011 @ 17:11
    Casper Søgaard
    0

    ;-)

  • 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