Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a section of a template that I only want displayed if a Macro has been picked.
<div class="banner dark"> <div class="container"> <ul class="statistics flex"> @Umbraco.Field("productStatistic") </ul> </div>
So essentially an If statement wrapped around this along the lines of:
IF a productStatistic macro has been selected - display this banner.
Can anyone help me with this? Thanks in advance!
Hi Stefan,
why not just add a property boolean which you pass into the macro?
Then you could create a param showTemplate and do a check on this in order to show/hide the actual html?
showTemplate
You can read more about macro's with parameters in the docs: https://our.umbraco.org/documentation/reference/templating/macros/#rendering-macros-with-parameters
Hope this helps!
/Michaël
did you solve your issue?
Can you share it with the community? Thanks!
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.
Continue discussion
How to check if a macro has been picked
I have a section of a template that I only want displayed if a Macro has been picked.
So essentially an If statement wrapped around this along the lines of:
IF a productStatistic macro has been selected - display this banner.
Can anyone help me with this? Thanks in advance!
Hi Stefan,
why not just add a property boolean which you pass into the macro?
Then you could create a param
showTemplate
and do a check on this in order to show/hide the actual html?You can read more about macro's with parameters in the docs: https://our.umbraco.org/documentation/reference/templating/macros/#rendering-macros-with-parameters
Hope this helps!
/Michaël
Hi Stefan,
did you solve your issue?
Can you share it with the community? Thanks!
/Michaël
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.