Copied to clipboard

Flag this post as spam?

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


  • DYOW 4 posts 24 karma points
    May 04, 2011 @ 13:58
    DYOW
    0

    Problem with Multi-node Tree Picker

    I'm new Umbraco and XSLT so please be gentle.

    I'm using the multi-node tree picker to do an image gallery and I have a problem getting this code to work:

     <xsl:template match="/">
      
      <!--
      uComponents: Multi-node Tree Picker - An XSLT example
      =====================================
      The Multi-node Tree Picker data-type will provide XML data based on the nodes you have selected.
      In this example, the property alias name for the Multi-node Tree Picker is "treePicker".
      -->
      
      <!-- First we check that the Multi-node Tree Picker has any nodeId values -->
      <xsl:if test="$currentPage/images/MultiNodePicker/nodeId">
      
       <xsl:for-each select="$currentPage/images/MultiNodePicker/nodeId">
        <xsl:copy-of select="umbraco.library:GetMedia(., 0)" /><br />
        <xsl:variable name="media" select="umbraco.library:GetMedia(., false())" />
        {$media/umbracoFile}
        <br />
       </xsl:for-each>
      </xsl:if>
      
     </xsl:template>

    The copy of select writes out the following relevant XML:

    <Image id="1115" version="f41046c2-2153-479e-af1e-3de363232017" parentID="1113" level="2" writerID="0" nodeType="1032" template="0" sortOrder="2" createDate="2011-05-03T22:35:29" updateDate="2011-05-03T22:35:29" nodeName="Product01L.jpg" urlName="product01l.jpg" writerName="Chris" nodeTypeAlias="Image" path="-1,1113,1115"><umbracoFile>/media/641/Product01L.jpg</umbracoFile>
    <umbracoWidth>720</umbracoWidth>
    <umbracoHeight>1000</umbracoHeight>
    <umbracoBytes>104998</umbracoBytes>
    <umbracoExtension>jpg</umbracoExtension></Image>

    On the page {$media/umbracoFile} is displayed exactly as it appears in the XSLT macro file.

    Ultimately I will be using ImageGen and putting the first ten images returned into an unordered list with all images also be saved in a JavaScript array - that part'll be easy once I can get {$media/umbracoFile} to work.

    Thanks

    Chris

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 04, 2011 @ 14:03
    Kim Andersen
    1

    Hi Chris

    You need to wrap the small snippet in am img-tag like this:

    <img src="{media/umbracoFile}" alt="" />

    I hope the above code makes sense :)

    /Kim A

  • DYOW 4 posts 24 karma points
    May 04, 2011 @ 14:16
    DYOW
    0

    Hi Kim,

    I tried that but only got:

    <img src="" alt="" /> 

    What else should I try?

    Thanks

    Chris

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 04, 2011 @ 14:24
    Jeroen Breuer
    0

    Hello,

    Did you also have a look at the Digibiz Advanced Media Picker? You can do the same thing as with MNTP, but it has more options. Here is a quick video on how to use it: http://www.screenr.com/TEY

    Jeroen

  • DYOW 4 posts 24 karma points
    May 04, 2011 @ 18:12
    DYOW
    0

    I've not looked at DAMP mostly because I think it said somewhere that it hadn't been tested with 4.7?

    I'm more than happy with the way MNTP works, I just don't understand why I'm not getting any value returned from "{media/umbracoFile}"

    Is there a problem with the XML, the XSLT, my understanding of how it should work or something else? I'm editing the file in Web Matrix, saving it then refreshing the page served from IIS7.5. I also have VS 2010 available if that would help.

    Using the following code I can print out the XML which appears to have all the data I need, I just can't use it!

    <xsl:copy-of select="umbraco.library:GetMedia(., 0)" />

    Thanks

    Chris

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 04, 2011 @ 18:52
    Kim Andersen
    1

    Ohh Chris, I can see that I forgot the dollar sign in front of media in my snippet. Cound you try the snippet i provided but with a $ in front of media? :)

    /Kim A

  • DYOW 4 posts 24 karma points
    May 04, 2011 @ 18:54
    DYOW
    0

    Hi Kim,

    Thanks, that fixed it.

    LOL looking at all the examples I can see the dollar sign everywhere, just not in my XSLT!

    Thanks :o)

    Chris

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 04, 2011 @ 18:55
    Lee Kelleher
    0

    Edit: Deleted my reply, as I was too slow! ;-)

Please Sign in or register to post replies

Write your reply to:

Draft