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
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 :)
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 :)
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
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
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
is working on a reply...