Copied to clipboard

Flag this post as spam?

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


  • Jules 276 posts 587 karma points
    Dec 12, 2014 @ 18:30
    Jules
    0

    Macro to render content of another macro inserted into RTE

    Umbraco 6.2.0 Not MVC.  Generally Razor macroscripts.

    Dealing with a site currently which has made extensive use of Macros and macro containers.  Each page contains a set of macros which make up the structure and content.

    In one case, we have a macro which renders the content of another content node. 

    In this case the other node contains an RTE into which the customer wants to add videos.

    I thought we could use a macro to render the html for the video (complex html for cross browser compatibility).

    However, since this RTE is on a node which is rendered by a macro on another node, all that we end up with in the page output is 

    <?UMBRACO_MACRO hidetitle="1" macroAlias="ContentVideoSingle" />

    Is there a way I can get Umbraco to deal with this scenario? Failing that does anybody know of a clever way to get this to work?

    J

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 14, 2014 @ 19:12
    Jan Skovgaard
    0

    Hi Jules

    Hmm, that's a tricky one. Could you perhaps show us the code of the macro that is being used to render the output currently? I think that perhaps umbraco.library.RenderMacroContent can be used (If that supported in razor macroscripts).

    But think it will be easier if you shared some code :)

    /Jan

  • Jules 276 posts 587 karma points
    Dec 22, 2014 @ 11:03
    Jules
    0

    Got this to work in a somewhat cludgey way but still okay.

    The macro is rendered as 

    <?UMBRACO_MACRO hidetitle="1" videoId="5647" macroAlias="ContentVideoSingle"/>

    Basically I am running a regex to find each instance of a macro fragment as above and then using the macro fragment as input for RenderMacroContent - that allows me to do a string.replace on on the rte content string which I can then output with Html.Raw(rteContent) and all is well :)

    J

     

Please Sign in or register to post replies

Write your reply to:

Draft