Copied to clipboard

Flag this post as spam?

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


  • Rafe 21 posts 42 karma points
    Mar 30, 2011 @ 17:41
    Rafe
    0

    macro in rich text editor wont work

    Hi again guys, I'm running 4.5.2 and have a simple macro, which is basically an asp.net user control that has <div>hello world</div> as its content. I have a macro created in the cms, and it is marked "Use in editor", so I am able to insert the macro into a rich text editor.

    However, when I insert the macro into a rich text editor, the content (<div>hello world</div>) doesn't show up in the content. The content before and after the macro show up, but not the macro content.

    What might I be missing or doing wrong?

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 30, 2011 @ 18:07
    Kim Andersen
    0

    Hi Rafe

    If you want to render the macro inside the editor in the back office, you need to put a checkmark in the"Render in editor"-checkbox on the macro. Is this what you're trying to achieve or am I totally off here?

    /Kim A

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 30, 2011 @ 18:08
    Tom Fulton
    0

    Hi Rafe,

    Are you getting the message along the lines of "No macro content available .." in place of the text?  I think this is a bug introduced around 4.0.4.2 and fixed in 4.6+.  Just to be sure though, make sure you have the "Render content in editor" checkbox selected on the macro?

    -Tom

  • Rafe 21 posts 42 karma points
    Mar 30, 2011 @ 18:12
    Rafe
    0

    Yes, I am getting the "No macro content available .." message in the editor, but it's not so important that the content renders in the editor. My main problem at this point is that the macro doesn't render out on the actual public-facing page (when the document is rendered out via a template). I have both "use in editor" and "render in editor" check on the macro settings. I am able to insert the macro into the editor. But when the document is published and viewed, the content of the macro does not show up.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 30, 2011 @ 18:18
    Tom Fulton
    0

    How are you outputting the RTE content to your template?  Via an umbraco:Item tag in the template or are you calling it with XSLT?

  • Rafe 21 posts 42 karma points
    Mar 30, 2011 @ 18:37
    Rafe
    0

    The RTE content gets injected into a macro that is in the template.

    So essentially there is a NewsItem macro that has this:

     


            <%# DataItem.GetProperty("content").Value %>

     

    Here DataItem is the current Node object. And the "content" property is the RTE.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 30, 2011 @ 18:42
    Tom Fulton
    2

    I think you'll need to use the umbraco.library:RenderMacroContent(content, pageId) function to get the macro to render from within another macro.

    Something like this (?):

     <%# umbraco.library:RenderMacroContent(DataItem.GetProperty("content").Value, DataItem.Id) %>

    Related thread - http://our.umbraco.org/forum/developers/extending-umbraco/10307-Rendering-Macro-Content-via-User-Controls

    -Tom

  • Rafe 21 posts 42 karma points
    Mar 30, 2011 @ 19:17
    Rafe
    0

    THAT WORKED! Thanks so much Tom!

Please Sign in or register to post replies

Write your reply to:

Draft