Copied to clipboard

Flag this post as spam?

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


  • jefferycxl 35 posts 83 karma points
    May 23, 2009 @ 08:37
    jefferycxl
    0

    How to display image in xlst

    Hi guys girls

    I have used xlst pagination on mywebsite, I have a document type called "article" and one of the property of the article entity is a image [media picker], I call it "'nationalicon'", which basiclly display a national flat image.

    I want to display this attribute on my web page, instead of seeing the image, I saw a number displayed at the place of the image.

    http://www.airforcewing.com/wings.aspx?page=1

    Any ideas.. here is my xlst code.


    Thanks alot.


    [code]



    [/code]



  • Tommy Poulsen 514 posts 708 karma points
    May 23, 2009 @ 09:30
    Tommy Poulsen
    0

    Hi Jefferycxl

    You have to ude the library function GetMedia in order for you to access and show media - what you have now is the media id.

    [code]

    ...


    ...




    [/code]

    See http://blackpoint.dk/umbraco-workbench.aspx?Snippet=/umbraco-workbench/xslt/accessing-media-files.aspx for more info.

    Tommt

  • jefferycxl 35 posts 83 karma points
    May 25, 2009 @ 08:00
    jefferycxl
    0

    Hi Tommt

    Thank you so much for your help. I hard coded the media id into it and it works,but then I had this trouble of using passing the media id into a local variable and use it in the image code:








  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 25, 2009 @ 08:22
    Dirk De Grave
    0

    Hi,

    Remove the () chars from the select as in:

    [code]
    [/code]
    Hope this helps.

    Regards,
    /Dirk


  • jefferycxl 35 posts 83 karma points
    May 25, 2009 @ 12:48
    jefferycxl
    0

    Hi Dirk

    Thanks for your reply. I am still unable to pass the document attribute value into a variable:

    I got error:
    Error occured

    System.OverflowException: Value was either too large or too small for an Int32.



    I think there there is a syntax error in my code:








    Thanks & Regards,

    Jeffery

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 25, 2009 @ 12:57
    Dirk De Grave
    0

    Hi jefferycxl,

    Happens when a var doesn't get a 'real' value when saving the xslt (in your case: 'iconId'), resulting in a GetMedia call with NaN value as the first param)

    2 options here:

    - tick 'ignore errors' and save xslt.
    - surround the complete snippet with an extra if statement

    [code]
    [/code]

    Latter option is best practice!

    Cheers,
    /Dirk

  • jefferycxl 35 posts 83 karma points
    May 25, 2009 @ 13:05
    jefferycxl
    0

    Fantastic !

    You not only solve my problem also teach me why.

    Thanks & Regards,

    Jeffery

  • alek.sys 0 posts 20 karma points
    Jun 01, 2009 @ 19:46
    alek.sys
    0

    Hi all, here is solution:
    [code]

    [/code]

    "If"-check solved the problem. I think, it because on design time (in developer mode) $currentPage/data[@alias='photo'] have no value, so we got Overflow exception.

  • Johan Roug 97 posts 153 karma points
    Aug 20, 2009 @ 01:13
    Johan Roug
    0

    Thank you Alek.sys.. that helped me

  • 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