Copied to clipboard

Flag this post as spam?

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


  • newguy 16 posts 20 karma points
    May 26, 2009 @ 02:00
    newguy
    0

    I cannot get mediapicker to work

    Can someone give me a working example of "GetMedia" using the mediapicker in a macro?
    I must have tried 5 different xslt examples of inserting a image onto a page but nothing works for me.
    can someone give me an "idiots guide"
    I have come from CMSMS but wanted to give this umbraco a try

  • Duke Maximus 23 posts 20 karma points
    May 26, 2009 @ 05:09
    Duke Maximus
    0

    I think this is what you're looking for.

    [code]





    [/code]

  • Daniel Lindstrom 454 posts 271 karma points
    May 26, 2009 @ 09:50
    Daniel Lindstrom
    0

    [quote=Duke Maximus]I think this is what you're looking for.

    [code]





    [/code][/quote]

    And to avoid an error when saving the XSLT, put an if:test around the GetMedia function call:




  • newguy 16 posts 20 karma points
    May 26, 2009 @ 17:23
    newguy
    0

    when I place that snippet into a xslt like so:
    [code]

    ]>

    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">









    [/code]


    I get this error:

    [code]
    Error occured
    System.Xml.Xsl.XsltException: The variable or parameter 'image' is either not defined or it is out of scope.


    [/code]

    And if I take out the "if" statements and save with "Skip testing (ignore errors)" checked
    and try place the macro on a page I get:

    "Error parsing XSLT file: \xslt\testing.xslt"

    This is the kind of frustrations I have been up against all week trying to do this.
    does someone have a complete idiots guide to this?
    is there any documentation about how to use mediapicker and place the variables in a macro and how the macro is supposed to look?

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

    Hi,

    What if you'd write this:

    [code]

    [/code]

    (adding the img tag inside the if statement, to make sure the variable is still in scope at that point)

    Hope this helps.

    Regards,
    /Dirk

  • newguy 16 posts 20 karma points
    May 26, 2009 @ 22:18
    newguy
    0

    @Dirk, thanks for that.
    so now the xslt will save without complaining, this is what the whole xslt looks like now:
    [code]

    ]>

    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">










    [/code]

    dropping the macro on a page does not render anything.
    macro properties are set to:
    "Use in editor" checked=yes
    "Render content in editor" checked=yes
    after picking an image nothing shows up...just blank

    Is this the correct way to use it in a macro in a template?

    [code]

    [/code]

    what I want to do is setup a different header image for different parts of the site and be able to use mediapicker to choose the different headers.
    but so far cannot get the mediapicker to work.

  • newguy 16 posts 20 karma points
    May 27, 2009 @ 23:50
    newguy
    0

    I am now able to insert an image using the mediapicker with this xslt:
    [code]

    ]>

    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">





    [/code]

    when I drop the macro on a page I see the image in the editor but it does not show up on the web page?



  • Duke Maximus 23 posts 20 karma points
    May 29, 2009 @ 08:49
    Duke Maximus
    0

    What are you passing in

    [code][/code]

    What parameter type are you using by the way?

  • 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