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.
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.Hi Saied.
When you want to render the macro in your template, you can use:
@Html.Raw(Umbraco.Field("macroPickerAlias"))
Hi Dennis,
I was using
@Umbraco.Render
. I will try your suggestion and get back to you.Thanks again, Saied
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!
Dennis,
It worked great.
Thanks so much, Saied
Awesome Saied!!! :)
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.