Copied to clipboard

Flag this post as spam?

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


  • Rick 36 posts 150 karma points
    Aug 10, 2011 @ 16:17
    Rick
    0

    Macro in TinyMCE not rendering content

    Hey all,

    I must be missing something simple here.  I've created a maco and, through the UI controls, inserted the macro into the TinyMCE rich text editor.  In the UI, the results of the maco renders as I would expect in the editor, but when I publish the page, nothing is rendered..at all...for the macro.  I've put some static text before and after the macro and that shows up on the live page with no issue.

    What am I missing here?

    Running version 4.7.0.

    Thanks in advance!

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Aug 10, 2011 @ 18:34
    Jan Skovgaard
    0

    Hi Rick

    How are you fetching the content from your RTE? Is it fetched with a XSLT macro or using umbraco:Item for instance?

    /Jan

  • Rick 36 posts 150 karma points
    Aug 10, 2011 @ 19:23
    Rick
    0

    Hi Jan,

    XSLT macro.  I'm simply using the Insert Macro button from the MCE editor, and selecting the macro.  To rule out an issue with the macro, I created a test one with only <xsl:text>gdi</xsl:text> with no change.

    Whats really bothering me is that I went to another one of my sites running 4.6.1 and its working fine.

    I've also tried going into the tinyMceConfig and adding the elements that inserting the macro puts in, to the validElements for the div with no change. e.g. - Dumping the macro into tinyMCE results in this HTML:

    <div umb_macroalias="Test" ismacro="true" onresizestart="return false;" umbversionid="828604d4-b981-4e6b-b9b7-b0c267da4f17" umbpageid="1099" title="This is rendered content from macro" class="umbMacroHolder"><!-- startUmbMacro -->gdi<!-- endUmbMacro --></div>

    ...so I updated the validElements for a DIV to this...

    -div[id|dir|class|align|style|umb_macroalias|ismacro|onresizestart|umbversionid|umbpageid|title]

    It was a long shot, but making that change fixed an issue that I was having with the <p> element in the past but didnt help in this case.

    Thanks in advance!

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Aug 10, 2011 @ 20:20
    Jan Skovgaard
    0

    Hi Rick

    In that case you should look into rendering the RTE content using the GetItem extension as far as I remember.

    You can read a bit more about the extension in here: http://our.umbraco.org/wiki/reference/umbracolibrary/getitem

    You should be able to render your content by using it like this: <xsl:value-of select="umbraco.library:GetItem(@id,'aliasOfRte')" disable-output-escaping="yes" />

    Have you checked to see how it is in fact working with 4.6.1? I'm almost certain it must work another way since what you're basically trying to do is rendering a xslt macro within another xslt macro...:-)

    Hope this helps.

    /Jan

  • Rick 36 posts 150 karma points
    Aug 10, 2011 @ 21:56
    Rick
    0

    Thanks for the feedback Jan...I'll give that a shot, but I'm not confident that will resolve my issue for the long run.  Here's the situation...

    When completed, this site will be handed over to the client for maintaining the content.  In the design, the client has content has some content the needs to be genereated via XSLT (related links in this case).  So, the plan was to provide them with the RTE to create the tables/content/copy, then be able to just insert the macro (which points to the XSLT) to stick in the content that they want in more than one place.

    So, although I'd have no problem dealing with the code, the user needs this to be a simple as possible so being able to just insert the macro is the perfect solution.  Coming from the XSLT side to pull the RTE content may not work well...but I'll give a try.  It may be the only solution.

    I took a closer look at the 4.6.1 site that inserting the macro in works like a champ, and the HTML being rendered in the RTE is identical. I created the same test xslt script/macro and inserted it into the RTE using the same process as the v4.7.0 install and it works perfectly.  Not really sure what the deal is.

    One of those things that I've done before and came in thinking it would be an hours work...

    Thanks again...

  • Rick 36 posts 150 karma points
    Aug 15, 2011 @ 22:51
    Rick
    0

    Hello again Jan,

    The GetItem approach didn't work (same result, no content from the macro rendered), but the issue is resolved and it was the nested macros I was doing on my end. I had all of my rendering within a macro so I could wrap some XSLT logic around it to perform some tasks which worked great until I ran into this issue.

    In short, the fix was to just render the item at the template level, not in the macro.  As my original approach was flawed, this did require me some re-working of my main templates, but its working fine now.

    Thanks for your guidence.

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 15, 2011 @ 22:58
    Tom Fulton
    0

    Not sure if this helps you, but if you are rendering a Rich Text field from an XSLT macro, and you want any inserted macros to render, you need to use RenderMacroContent:

    <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/yourTinyMceField, $currentPage/@id)" disable-output-escaping="yes" />

    -Tom

  • James Loughney 1 post 21 karma points
    Oct 28, 2011 @ 10:12
    James Loughney
    0

    Hi,

    I am running into a similar problem, I am rendering the content of the rich text editor directly onto the template using <umbraco:Item Field="bodyContent" runat="server" />.

    The macro within the RTE content is a .net ascx macro and I can see it rendered within the rich text editor in the umbraco back end. But when I try to view the page on the frontend the macro is not rendered at all. I have also included text within the RTE and this is displayed, just not the macro.

    Can anyone help with this? I am fairly new to umbraco and this one has me a little stumped at the moment.

     

    Thanks in advance.

     

    James

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 28, 2011 @ 14:05
    Tom Fulton
    1

    Hi James,

    There shouldn't be anything extra you need to do.  I don't know why you'd see it in the RTE but not on the rendered page.

    You can add ?umbdebugshowtrace=1 to your URL to get the stack trace and see if the macro is actually getting rendered with your bodyContent item and if any errors occur.  You should get something like:

    You might also try debugging from visual studio by attaching to your IIS process to see if the UC is getting hit at all.  Is the usercontrol doing anything strange?

    -Tom

  • Craig Cronin 304 posts 503 karma points
    Apr 15, 2013 @ 11:57
    Craig Cronin
    0

    Just came across this post and Tom's post fixed this for me!!!

Please Sign in or register to post replies

Write your reply to:

Draft