Copied to clipboard

Flag this post as spam?

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


  • BEWD 90 posts 303 karma points
    Jan 23, 2016 @ 11:17
    BEWD
    0

    Allow a user to choose to display a macro.

    Hi again

    I have created several sections of a site as Macros which I want the user to be able to choose which one they would like to use on certain pages.

    I have added a True/False property and attempted to wrap the macro(s) in a If = 1 (or True etc) then display logic

    eg

    @if (item.GetPropertyValue("displayServices") == "True")
    {
    @Umbraco.RenderMacro("Services")
    }
    

    If I add the @Umbraco.RenderMacro("Services") direct into the page then it works fine but how can i let the user decide if they want to display it or not?

    Is it even possible to do this way?

    Thanks

    Ben

  • BEWD 90 posts 303 karma points
    Jan 23, 2016 @ 12:53
    BEWD
    0

    I have found this which works but I would like the user to be able to edit the details of the macro

    http://www.ablogaboutcoding.com/2015/10/02/creating-a-custom-component-in-umbraco-7/

    Using it this way does not allow the user to edit the text, If is grayed out, Is there a way that I can make this editable?

    enter image description here

    Or am I going about it all wrong?

  • 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