Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 17, 2011 @ 11:27
    Simon Dingley
    0

    Media Folder Node Empty

    I am trying to get a list of images in a Folder of the media section however the folder is just returning XML with an empty  <content /> node despite there being images in the folder.

    <Folder id="1124" 
        version="04d7e7d5-736c-4ad0-b554-c13cca0faf2b" 
        parentID="-1" 
        level="1" 
        writerID="0" 
        nodeType="1031" 
        template="0" 
        sortOrder="63" 
        createDate="2011-02-17T09:07:28" 
        updateDate="2011-02-17T09:07:28" 
        nodeName="Headers" 
        urlName="headers" 
        writerName="Administrator" 
        nodeTypeAlias="Folder" 
        path="-1,1124"><contents /></Folder>    

    I can confirm that the id is correct for the folder in the media section and there is 5 JPG images in there which are not being returned in the XML when I use:

    <xsl:copy-of select="$StartNode/Folder" />

    any ideas anyone?

    Thanks, Simon

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Feb 17, 2011 @ 11:34
    Matt Brailsford
    0

    Hey Simon,

    How are you setting the $StartNode variable?

    Cheers

    Matt

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 17, 2011 @ 11:36
    Sebastiaan Janssen
    1

    In your GetMedia call, set deep to true. If that's not possible, do a new GetMedia call with the id of $StartNode and then set deep to true in that one:

    <xsl:variable name="AllFiles" select="umbraco.library:GetMedia($StartNode/@id, 1)"/>
  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 17, 2011 @ 11:38
    Simon Dingley
    0

    It's coming via a mediaCurrent macro parameter so I'm guessing as per something Sebastiaan just said on twitter it may just be that it only returns the current node and not it's children?

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Feb 17, 2011 @ 11:38
    Matt Brailsford
    1

    Damn you sebastiaan :P

    Ok, so on top of Sebastiaans answer, if you have this setup as a macro and have a MediaCurrent property type setup, yes, this will return a media Item, but it won't be deep as Sebastiaan has mentioned, so you'll need to do a GetMedia with the deep set to true to get the child media items.

    Matt

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 17, 2011 @ 11:41
    Sebastiaan Janssen
    0

    lol @ Matt, I do still like XSLT ;-)

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 17, 2011 @ 11:52
    Simon Dingley
    0

    Thanks guys - "there can be only one"...solution I'm afraid :)

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Feb 17, 2011 @ 11:54
    Matt Brailsford
    0

    Beh! I think you'll find I was the one that described the actual issue you were having, Sebastiaan just pasted some code with no reasoning :P

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 17, 2011 @ 11:55
    Sebastiaan Janssen
    0

    What are we, back in highschool? ;-)

Please Sign in or register to post replies

Write your reply to:

Draft