Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3921 karma points c-trib
    Nov 03, 2010 @ 15:44
    Dan
    0

    Get media id from mediaCurrent macro parameter type

    Hi,

    I have a macro which takes two parameters - both mediaCurrent data types.  Both of these are used to load images into the macro.

    The values are being passed through okay, but instead of media id the mediaCurrent data type seems to send a full string of the media item e.g. 'media/987/mypic.png801075259png'.  I just need the first part (the file path).

    Question is, how to I get just the file path out of this?  I expected the output of a mediaCurrent data type to be in XML, but if I output the value into a <textarea></textarea> it still just shows as a string it seems, so I'm a little confused how to deal with it, other than some really hacky XSLT regular expression or string manipulation.

    Thanks

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 03, 2010 @ 15:55
    Tom Fulton
    0

    Hi Dan,

    The mediaCurrent type returns the entire XML for the Media Item, you'll see this if you do a <xsl:copy-of... into a textarea.

    To get just the file path: 

    <xsl:variable name="yourVariable" select="/macro/yourParam"/>
    <xsl:value-of select="$yourVariable/*/umbracoFile"/>

    -Tom

  • Happyfanaticsalsero 59 posts 81 karma points
    Nov 03, 2010 @ 15:56
    Happyfanaticsalsero
    1

    Hi

    Suggestion: do an xsl:copy-of of the mediaCurrent, that will show you all the xml structure underneath, so you can define the Xpath you'll need. I think it will turn out to be a "/umbracoFile" xpath.

    /HFS

Please Sign in or register to post replies

Write your reply to:

Draft