Copied to clipboard

Flag this post as spam?

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


  • Jeremy Drouin 9 posts 29 karma points
    Jan 19, 2012 @ 17:15
    Jeremy Drouin
    0

    Listing media child nodes/sub folders

    I am trying to get a listing of child node folders from a specific media id, which is chosen in with the media picker. The folder structure is as follows:

    Media
     - Departments
         - Department A
             - Photo Group 1
    - photo 1, photo 2, etc...
     - Photo Group 2
    - photo 1, photo 2, etc...

    In the media picker I have Department A selected and with the code below, it will only display images that are in that folder directly. I cant seem to figure out how to retrieve the photos in the children folders/nodes. I have tried using $currentPage/DepartmentGallery/*[@isDoc], but that does not seem to return anything

    <xsl:variable name="imageRoot" select="$currentPage/DepartmentGallery"/>
      <xsl:if test="string-length($imageRoot) &gt; 0">
        <xsl:for-each select="umbraco.library:GetMedia($imageRoot, '0')/Image">
          <img src="{umbracoFile}" width="100"/>
        </xsl:for-each>
      </xsl:if>

    Thanks for the help!

  • Rodion Novoselov 694 posts 859 karma points
    Jan 19, 2012 @ 17:25
    Rodion Novoselov
    0

    Hi. Try this:

    <xsl:variable name="imageRoot" select="$currentPage/DepartmentGallery"/>
      <xsl:if test="string-length($imageRoot) &gt; 0">
      <xsl:for-each select="umbraco.library:GetMedia($imageRoot, '0')/descendant::Image">
        <img src="{umbracoFile}" width="100"/>
      </xsl:for-each>
    </xsl:if>
  • Jeremy Drouin 9 posts 29 karma points
    Jan 19, 2012 @ 17:27
    Jeremy Drouin
    0

    Wow, so simple of a solution. Thanks so much!

Please Sign in or register to post replies

Write your reply to:

Draft