Copied to clipboard

Flag this post as spam?

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


  • Saied 349 posts 674 karma points
    Jun 22, 2016 @ 18:09
    Saied
    0

    Specifying a macro parameter when creating it, not when inserting it in a template?

    I created a macro with one parameter. I created a macro container data type and when I add the macro to my node, it asks me for the parameter which is fine. This parameter can vary depending on the site.

    So now I want to render the proper macro using @Umbraco.RenderMacro, but when I insert the macro into the template, it is asking me for the parameter, but I don't want the parameter to be specified here, I want it to be specified when the editor chooses the macro at the content level.

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 22, 2016 @ 18:48
    Dennis Adolfi
    100

    Hi Saied.

    When you want to render the macro in your template, you can use:

    @Html.Raw(Umbraco.Field("macroPickerAlias"))

  • Saied 349 posts 674 karma points
    Jun 22, 2016 @ 18:52
    Saied
    1

    Hi Dennis,

    I was using @Umbraco.Render. I will try your suggestion and get back to you.

    Thanks again, Saied

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 22, 2016 @ 18:56
    Dennis Adolfi
    0

    If I'm not wrong, Umbraco.RenderMacro is used when you want to insert the macro directly in the template with parameters, not through a content node.

    Let me know if it works out for you!

  • Saied 349 posts 674 karma points
    Jun 22, 2016 @ 19:09
    Saied
    1

    Dennis,

    It worked great.

    Thanks so much, Saied

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 22, 2016 @ 19:10
    Dennis Adolfi
    0

    Awesome Saied!!! :)

  • 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