Copied to clipboard

Flag this post as spam?

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


  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Sep 04, 2013 @ 08:50
    Thor Madsen-Holm
    0

    Macro inserted in RTE not rendered when using macro caching

    Hi, 

    I am experiencing a problem with macro caching on a newly created v. 6.1.4 site running in WebForms mode. 
    Here's my problem: 
    I have one macro on the page called Document that basicly renderes everything within the <body> tag of the page, this macro renders an RTE property among others. I have created a few other macro's for use in the RTE (xslt search, contour etc). This all works fine. But when enable macro caching on my Document macro the macros inserted in the RTE field does not render anymore. 

    Is this a bug or is there some speciel way to render the RTE macro to make sure it's shown when using macro caching? 

    Any help will be greatly appreciated. 

    /Thor


  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 04, 2013 @ 09:17
    Chriztian Steinmeier
    100

    Hi Thor,

    Taking wild guesses here, but I would assume that it's because when you "render" the RTE field, you're doing something smiliar to <xsl:value-of select="bodyText" disable-output-escaping="yes" />, right?

    I think the actual macro parsing happens later, but when you use caching, this is probably skipped for some reason (could be a bug)...

    What you can try is to use the RenderMacroContent() extension instead, like this:

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

    - which should render your RTE macros before the caching happens (I think :-).

    Does this make sense?

    /Chriztian

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Sep 04, 2013 @ 11:16
    Thor Madsen-Holm
    0

    Hi Chriztian, 

    I am actually rendering it like this: <xsl:value-of select="umbraco.library:Item($currentPage/@id,'content')" />

    I haven't  tried out the RenderMacroContent method, so I will give that a try and report back :) - Thansk for the input

    /Thor

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Sep 04, 2013 @ 18:15
    Thor Madsen-Holm
    0

    Hi Chriztian, 

    I just had a chance to try out your solution. Unfortunately that didn't work either.
    Furthermore I just realised that no content is rendered at all when using umbraco.library:RenderMacroContent or  umbraco.libray:Item and macro caching is turned on. If i just do a  <xsl:value-of select="bodyText" disable-output-escaping="yes" /> the text in the RTE field is rendered but not the macro.

    Seems like it could be a bug.

    /Thor  

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Jan 09, 2014 @ 13:00
    Thor Madsen-Holm
    0

    Hi Chriztian, 

    Just wanted to say that your solution worked! It was just me doing it wrong. Thanks for the help.

    /Thor  

  • Prasanna Bajracharya 3 posts 50 karma points
    Feb 05, 2014 @ 05:43
    Prasanna Bajracharya
    0

    Hello Thor,

    Can you share your working solution ?

    Prasanna 

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Feb 05, 2014 @ 16:44
    Thor Madsen-Holm
    2

    Sure thing Prasanna, 

    First i tried this: 

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


    But for some odd reason that did not work, however when I put the content in a variable and then pass that variable into the RenderMacroContent method it worked as expected:

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

    Hope this helps. 

    /Thor 

Please Sign in or register to post replies

Write your reply to:

Draft