Outputs: box1Image and not 21920
So how do I explain to XSLT that this is indeed a MediaPicker and that I want the MediaID and not the String "box1Image", so that I can finish up the job?
<xsl:value-of select="$currentPage/box1Image"/>
Correctly displays 21920.. however I don't want my field hardcoded into my macro, which would remove the whole point of creating a Macro.
I've looked all over the forums, but for some reason my scenario where I reference the field as a paramter in the Macro doesn't seem to be a use case anyone else uses, so maybe I'm fundamentally misunderstanding something?
Thanks for that, though that's correct, that is not the issue I'm having, my issue is that I can get it to work if I directly reference $currentPage/box1Image, but I don't want to do that, I want to indirectly reference it through the parameters of the Macro, so that I can use the macro it load multiple images from different MediaPickers in the same Document/Template.
Yeah that works fine.. but in your case you're referencing the image directly with $currentPage/box1Image, where as I want to do it as a parameter on the Macro, so I don't have to create 3 macros for the same job.. having
Should I be doing that differently? Somehow extracting the mediaId and sending it to the Macro? I think the problem is that I'm just passing the string "box1Image" along and not the actual MediaPicker box1Image?
xslt for showing image
Okay.. I got this far:
And XLST:
My problem is that:
Outputs: box1Image and not 21920 So how do I explain to XSLT that this is indeed a MediaPicker and that I want the MediaID and not the String "box1Image", so that I can finish up the job?
Correctly displays 21920.. however I don't want my field hardcoded into my macro, which would remove the whole point of creating a Macro.
I've looked all over the forums, but for some reason my scenario where I reference the field as a paramter in the Macro doesn't seem to be a use case anyone else uses, so maybe I'm fundamentally misunderstanding something?
Hi Robin,
First of all what exact version of Umbraco are you using?
Best, -Dennis
umbraco v 4.9.1 (Assembly version: 1.0.4884.22745)
Hi Robin,
Okay thanks for the info. Can you then try to use this snippet of code.
Remember to change mainimage to the right alias in your case.
The issue is that you have mix up the old XML Schema which was changed in version 4.5 of Umbraco.
So this line of code
Should be:
Hope this helps,
/Dennis
Thanks for that, though that's correct, that is not the issue I'm having, my issue is that I can get it to work if I directly reference $currentPage/box1Image, but I don't want to do that, I want to indirectly reference it through the parameters of the Macro, so that I can use the macro it load multiple images from different MediaPickers in the same Document/Template.
Hi Dennis,
Yeah that works fine.. but in your case you're referencing the image directly with $currentPage/box1Image, where as I want to do it as a parameter on the Macro, so I don't have to create 3 macros for the same job.. having
As appose to:
Hope that makes sense.
Hi Robin,
Okay make sense.
Could you please try this code snippet
Hope this helps,
/Dennis
Hi again,
Yeah so this is what I've tried myself, or something similar. However the problem is that:
Using this code you provided:
The problem might be the way I'm referencing the field and sending the field "alias" throught?
My Macro looks like this:
Should I be doing that differently? Somehow extracting the mediaId and sending it to the Macro? I think the problem is that I'm just passing the string "box1Image" along and not the actual MediaPicker box1Image?
When I reference it in the template:
It works just fine, but how do I extract the ID?
Without knowing the Umbraco syntaks I'd think i'd need to extract it somethow.. like:
Is there really no one that knows what I'm doing wrong?
is working on a reply...