Copied to clipboard

Flag this post as spam?

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


  • Andrew Pearson 5 posts 25 karma points
    Dec 03, 2012 @ 05:58
    Andrew Pearson
    0

    Calling a macro from within a macro

    Hi,

     

    I am attempting to insert a value into a call to a macro from within a template. Originally the macro call looked like:

    <umbraco:Macro Url="http://www.mywebsite.com/include.php?part=banner&id=101&ver=3" Alias="ForeignContentFetcher" runat="server"></umbraco:Macro>

    I need to be able to change the id=101 to 102, 103, 104 etc

     

    My following code builds the Url correctly however i am unsure how i can insert it into the call to the macro.

     

    <umbraco:Macro runat="server" language="cshtml">

    <p>@Library.NodeById(Model.place).Code ---</p>

    @{

    string code = Library.NodeById(Model.place).Code; 

    string bannerID = "101";

    switch (code) {

    case "abc": 

    bannerID = "102";

    break;

    case "def":

    bannerID = "103";

    break;

    default:

    break;

    }

    string myurl = "http://www.mywebsite.com/include.php?part=banner&id=" + bannerID + "&ver=3";

    }

    </umbraco:Macro>

    Any help would be greatly appreciated.

     

Please Sign in or register to post replies

Write your reply to:

Draft