Copied to clipboard

Flag this post as spam?

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


  • synsat 30 posts 43 karma points
    Apr 03, 2010 @ 17:17
    synsat
    0

    XML representation of media

    Hi guys,

    If I have a macro parameter MyNode of type mediaCurrent, where I choose a media folder containing image files, should not

    <xsl:copy-of select="/macro/MyNode" /> give me something like

    <MyNode>

    <node id="1234" nodeTypeAlias="Folder" bla bla...>

    <image>
    <data alias="prop1">xxx</data>
    <data alias="prop2">xxx</data>
    </image>

    <image>
    <data alias="prop1">xxx</data>
    <data alias="prop2">xxx</data>
    </image>

    </node>

    </MyNode>

    Or should umbraco.library.GetMedia(int nodeid, bool deep) give me this xml representation? I have no success neither way.

    Thanks,
    Synsat

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 03, 2010 @ 22:36
    Morten Bock
    0

    It should output xml to the macro parameter, so <xsl:copy-of select="/macro/MyNode" /> _should_ give you some xml output, unless the ID you are entering into the parameter does not have any content in the DB.

     

  • synsat 30 posts 43 karma points
    Apr 03, 2010 @ 22:51
    synsat
    0

    But in this specific case, if my macro parameter is a mediaCurrent type, and I choose a folder containing images, how can I see the XML info for these?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 04, 2010 @ 12:26
    Morten Bock
    0

    Ah, you will not get the sub items when you use the mediaCurrent. You only get the specific item that you have selected, so in your case you only get the folder info, and not the child images.

    (By the way, are you using 4.0.x or 4.1? There might be differences between them)

  • synsat 30 posts 43 karma points
    Apr 04, 2010 @ 16:49
    synsat
    0

    Ok, thanks! I'm using 4.0,2. Is there a way to get the sub items? I am asking because I would like to have a randomly chosen image from a chosen folder. I cannot find how the folder is "connected" to it's sub items. Thanks.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 04, 2010 @ 17:51
    Morten Bock
    0

    If you change your macro parameter to be a number instead, then you can use the  umbraco.library.GetMedia(int nodeid, bool deep) to get sub items as well. just set the "deep" parameter to 1.

  • synsat 30 posts 43 karma points
    Apr 04, 2010 @ 18:32
    synsat
    0

    I have tried that a few times earlier without seeing the xml structure... Just realized that <xmp></xmp> is necessary :(

Please Sign in or register to post replies

Write your reply to:

Draft