Copied to clipboard

Flag this post as spam?

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


  • Thomas Nicolosi 2 posts 22 karma points
    Aug 03, 2010 @ 23:55
    Thomas Nicolosi
    0

    Code for retrieving an image does not match what's documented

    I am pretty new at umbraco and have recently run across something that seems strange. I have been trying to use media picker to place an editable image in my template. I read several posts that include the following code:

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

    However this does not work on my local installation.

    What works is this code:

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

    It took me quite a while to figure this out. Does anybody know what might be the problem with my installation or where I might start looking? Thanks!

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Aug 04, 2010 @ 00:30
    Chriztian Steinmeier
    0

    Hi Thomas,

    The XML format was changed from version 4.0 to 4.5 - so you might want to look around the forum for some more in-depth explanations to this.

    (Also, on a sidenote, the 'true' argument should really be true(), which is the correct way to signal a boolean true in XSLT - 'true' works, but only because any string will evaluate to a boolean true value...)  

    /Chriztian 

  • Bogdan 250 posts 427 karma points
    Aug 04, 2010 @ 00:41
    Bogdan
    0

    Hello Thomas,

    in the new version of umbraco, 4.5, the xml shema was changed and I think your first code example worked with the previous versions. You can start reading about it here and here.

     

    Hope this helps!

  • Thomas Nicolosi 2 posts 22 karma points
    Aug 04, 2010 @ 01:07
    Thomas Nicolosi
    0

    @bfi Thanks for the response and the links!  To complicate matters I have a local installation that uses the new version and an online installation that uses the old. I found this post on upgrading to Umbraco 4.5 - Is that current or do you recommend another procedure? @Chriztian thanks for the xslt info, again I am new to this and I was copying verbatim from what was posted here.

  • Bogdan 250 posts 427 karma points
    Aug 04, 2010 @ 09:41
    Bogdan
    0

    Yes, that is a good place to start. Be sure to get the latest version from codeplex , for .net 4 or 3.5 depending on your needs.

    Good luck!

  • 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