Copied to clipboard

Flag this post as spam?

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


  • ruben 8 posts 28 karma points
    Mar 29, 2010 @ 15:38
    ruben
    0

    XSLT: media picker data

    hi, I've been working with another cms for a couple of years now and recently started testing out umbraco.
     so far I discovered I'm pretty ignorant when it comes to XSLT so that's definetly a study point for me.
     the problem I'm currently having Is I can't seem to get to the data entered with a 'media picker' or a 'multiple media picker'
     I'm using the following code to test it:


     <xsl:value-of select="data [@alias = 'image']"/>

     the code above should display some data entered with a media picker... or so I thought.

     

    <xsl:if test="($currentPage/data[@alias='multi_img']/ descendant::node !='') "> 


     the code above is what I'm using to test if media files have been selected with a multiple media picker.
     I never seem to get past that test. I copied the code from the following page hoping to resolve this but it failed.
     http://umbraco.org/documentation/books/diary-of-a-newbody/rendering-the-output
     
     some extra facts:
     - the media picker in de document type has the name and alias 'image' and has 1 image chosen.
     - the multiple media picker in the document type has the name and alias multi_img and has several images selected.
     - I can retrieve the value of other document type fields, but getiing info media files don't seem to work.
     -  I use the following code in my template to retrieve the image from de media picker without problems:

    <umbraco:Item runat="server" field="image" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0}, true())/data[@alias='umbracoFile'], '&quot; /&gt;')"  xsltDisableEscaping="true"/>

     

    please forgive me if this question has been asked a thousand times (I did search the forum for some clues without success).

    any help will be greatly apreciated.

     

    Ruben

  • dandrayne 1138 posts 2262 karma points
    Mar 29, 2010 @ 16:13
    dandrayne
    1

    Hi Ruben

    This blog post from Lee Keheller shows how to use a mediapicker in a bulletproof way http://blog.leekelleher.com/2009/11/30/how-to-use-umbraco-library-getmedia-in-xslt/

    Hope this helps,
    Dan

  • ruben 8 posts 28 karma points
    Mar 29, 2010 @ 16:48
    ruben
    0

    Haven't had much time to look at it, but it does look very promising, thanks!

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Mar 30, 2010 @ 09:01
    Rasmus Berntsen
    0

    And there's also some info at the wiki:

    http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

  • Daniel Souchon 2 posts 22 karma points
    Sep 25, 2010 @ 23:16
    Daniel Souchon
    0

    dandrayne. Lee's post does NOT show the mediapicker it shows how to use GETMEDIA for a single image

    Not how to iterate through all the images represented by the media picker.

    Does anyone know how to do this?

     

  • Sebastian Dammark 547 posts 1287 karma points
    Sep 27, 2010 @ 00:45
    Sebastian Dammark
    2

    If you have a media picker where you pick a folder instead of an image and you want all the images in this folder, then just set the second parameter for the getmedia method to 1 instead of 0.

    Like this:
    <xsl:variable name="imageset" select="umbraco.library:GetMedia([mediaid], 1)" />

    Now your variable 'imageset' will contain all the images in the selected folder.

  • 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