Copied to clipboard

Flag this post as spam?

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


  • Aleksander 26 posts 56 karma points
    Feb 18, 2011 @ 12:03
    Aleksander
    0

    umbraco.library:GetMedia problem

    Hello!

    I am using a macro with this piece of code in it

    <xsl:value-of select="concat('&lt;div class=&quot;mainBlock&quot; ','style=&quot;background-image:url({(umbraco.library:GetMedia($currentPage/mainBackground, 0))/umbracoFile})&#59;&quot; &gt;')" disable-output-escaping="yes"/>


    but it generates

    <div style="" class="mainBlock">

    instead of

      <div style="(background-color:url(some mdia link))" class="mainBlock">

     

    What did I do wrong?

    Thanks in advance,

    Aleksandar.

     

     

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Feb 18, 2011 @ 12:12
    Chriztian Steinmeier
    0

    Hi Aleksandar,

    Try to break it up with a variable for fetching the media, to better check what's happening:

    <xsl:variable name="img" select="umbraco.library:GetMedia($currentPage/mainBackground, 0)/umbracoFile" />
    <xsl:value-of select="concat('&lt;div class=&quot;mainBlock&quot;', ' style=&quot;background-image:url(', $img, ');&quot;&gt;')" disable-output-escaping="yes" />

    Now you can replace the $img variable with a simple string, e.g.: '/media/1234/filename.png' and debug from there...

     /Chriztian

  • Aleksander 26 posts 56 karma points
    Feb 18, 2011 @ 12:32
    Aleksander
    0

    Hello, Chriztian.

    Thanks a lot. This was the decision. 

    Regards,

    Aleksandar

Please Sign in or register to post replies

Write your reply to:

Draft