I have created a .Net Control that takes the URL of an image. The image is set using a MediaPicker - pbsLogo. The Macro GetUrl converts it into a URL which is the input to the PBSPayment macro.
It does not work since it only displays the url - is it because it's not possible at all or am I just not doing it correcly?
I haven't seen it done before but why can't you just do the processing that happens in the GetUrl Macro in the PBSPayment macro. If you already sometimes pass the actual URL to the macro in other instances, you could just change the XSLT to check for it and put it in a new variable, such as:
<xsl:variable name="FinalImageURL">
<xsl:choose>
<xsl:when test= see if the 'ImageUrl' is a number >
Oh, you should be able to just use the umbraco library in your .Net control in order to get the image URL from the image ID (you will need to include umbraco.dll in your references)... I am assuming that you just need to get the URL from the ID (from the names of your macro and properties).
Macro as parameter to a macro
Hi
I have created a .Net Control that takes the URL of an image. The image is set using a MediaPicker - pbsLogo. The Macro GetUrl converts it into a URL which is the input to the PBSPayment macro.
It does not work since it only displays the url - is it because it's not possible at all or am I just not doing it correcly?
<umbraco:Macro PbsId="[#pbsId]"
DebitorGroup="[#pbsDebitorGroup]"
LinkText="[#LinkText]"
ImageUrl="<umbraco:Macro Alias="GetUrl" MediaPickerField="[#pbsLogo]" runat="server"></umbraco:Macro>"
Alias="PBSPayment"
runat="server">
</umbraco:Macro>
/Paul S
I haven't seen it done before but why can't you just do the processing that happens in the GetUrl Macro in the PBSPayment macro. If you already sometimes pass the actual URL to the macro in other instances, you could just change the XSLT to check for it and put it in a new variable, such as:
<xsl:variable name="FinalImageURL">
<xsl:choose>
<xsl:when test= see if the 'ImageUrl' is a number >
Do what ever you do in the macro called 'GetUrl'
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ImageUrl" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Hi
- why can't you just do the processing that happens in the GetUrl Macro in the PBSPayment macro
This is because the PBSPayment wraps a .Net Control so I don't see how I can do that.
/Paul S
Oh, you should be able to just use the umbraco library in your .Net control in order to get the image URL from the image ID (you will need to include umbraco.dll in your references)... I am assuming that you just need to get the URL from the ID (from the names of your macro and properties).
Hi Paul, you should use the Media object in your .NET control for this. Something like:
Hope this helps.
-- Nik
Thanks guys
That is of course the correct solution. I was looking in the wrong direction
/Paul S
Glad to help!
Cheers,
Nik
is working on a reply...
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.