Copied to clipboard

Flag this post as spam?

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


  • Henrik Bro 18 posts 38 karma points
    Sep 16, 2009 @ 19:57
    Henrik Bro
    0

    Load an image from media and use it inline style?

    I would like to load an image from media and use it inline style.

    My code (not working):

    <body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat('&apos;', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], '&apos;')" XsltDisableEscaping="true" />)">

    Result: <body style="background: url('')">

    <body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat('&quot;', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], '&quot;')" XsltDisableEscaping="true" />)">

    Result: <body style="background: url("/media/1/2.jpg")">

    I think it has to do with xml-escaping...

    Perhaps someone could enlighten me - or is it possible to do this?

    Site is running 4.0.2.1

    /Henrik

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 16, 2009 @ 20:41
    Dirk De Grave
    0

    Hi Henrik,

    I think you'll have to include <body style="background: url()"> into the xslt part of the umbraco item. It won't look nice nor readable, but might work.

     

    Cheers,

    /Dirk

  • Henrik Bro 18 posts 38 karma points
    Sep 16, 2009 @ 20:50
    Henrik Bro
    0

    Perfect it worked :)

    Thanks a lot

    /henrik

     

Please Sign in or register to post replies

Write your reply to:

Draft