Copied to clipboard

Flag this post as spam?

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


  • Paul Sørensen 302 posts 648 karma points
    Jan 23, 2010 @ 14:14
    Paul Sørensen
    0

    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

  • Seth Niemuth 275 posts 397 karma points
    Jan 23, 2010 @ 21:32
    Seth Niemuth
    0

    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>

  • Paul Sørensen 302 posts 648 karma points
    Jan 24, 2010 @ 12:59
    Paul Sørensen
    0

    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

  • Seth Niemuth 275 posts 397 karma points
    Jan 24, 2010 @ 17:27
    Seth Niemuth
    0

    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). 

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 24, 2010 @ 19:04
    Nik Wahlberg
    0

    Hi Paul, you should use the Media object in your .NET control for this. Something like:

    var file = new Media(mediaId);
    url = file.getProperty("umbracoFile").Value.ToString();

    Hope this helps.

    -- Nik

     

  • Paul Sørensen 302 posts 648 karma points
    Jan 24, 2010 @ 19:08
    Paul Sørensen
    0

     

    Thanks guys 

    That is of course the correct solution. I was looking in the wrong direction

    /Paul S

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jan 24, 2010 @ 19:12
    Nik Wahlberg
    0

    Glad to help!

    Cheers,
    Nik

  • 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