Copied to clipboard

Flag this post as spam?

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


  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 20:36
    Carlos
    0

    Macro inside RTE, pulling through XSLT

    Ok, I have an XSLT file that has my "bodyText" property in it.  In my bodyText RTE, I have inserted a macro.  Since my bodyText property is inside my XSLT file and not directly inside of my Template, there is an issue with rendering the Macro through the RTE.  I thought there was some sort of solution using the umbraco.library.RenderMacroControl. But I am not quite sure.

    Is there a way to do this? Thanks.

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 20:48
    Carlos
    0

    Ok I found an option for my issue, it works on one of the pages I am using

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

    One of my pages is showing <?UMBRACO_MACRO macroAlias="CateringAndEvents" />

    Any ideas? Thanks

     


  • Rodion Novoselov 694 posts 859 karma points
    Feb 02, 2012 @ 20:54
    Rodion Novoselov
    0

    Hi. You need to use the library.Item(...) method that ensures handling macros embeded into the bodyText or other RTE properties. E.g.:

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

    There's some pitfall however related to caching - there's been a discussion here recently about it that you can try to find by search if you're interesting. Nevertheless without caching this method seems to work all right.

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 21:19
    Carlos
    0

    Ok I found an option for my issue, it works on one of the pages I am using

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

    One of my pages is showing <?UMBRACO_MACRO macroAlias="CateringAndEvents" />

    Any ideas? Thanks

     


  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:00
    Carlos
    0

    @Rodion,

    That actually outputted the same <?UMBRACO_MACRO macroAlias="CateringAndEvents" />.  Did the same thing as the RenderMacroContent.  It may be something else.  For some reason it is working on other pages, but not on this particular one. Specifically the specific doctype.

    This is my full XSLT. It looks like it is trying to output the macro but is actually spitting out the Umbraco MACRO string or output. Not sure why.

    <xsl:when test="umbraco.library:GetXmlNodeCurrent()/@nodeType = 1140 or
      umbraco.library:GetXmlNodeCurrent()/@nodeType = 1143 or
      umbraco.library:GetXmlNodeCurrent()/@nodeType = 1488
      ">
            <xsl:call-template name="mobileBackHomeNavBar" />
            <xsl:call-template name="generalPageHeader" />
            <xsl:value-of select="umbraco.library:GetXmlNodeCurrent()/pageSubHeader"/>
            <div id="allContent">
              <div>
                <xsl:call-template name="mobileGeneralMediaHolder" />
              </div>
              
              <xsl:value-of select="umbraco.library:Item(@id, 'bodyText')" disable-output-escaping="yes"/>
        
            </div>
          </xsl:when>

  • Rodion Novoselov 694 posts 859 karma points
    Feb 02, 2012 @ 22:06
    Rodion Novoselov
    0

    Hmmm. Is there any unusual with "bla-bla-bla.aspx?umbDebugShowTrace=true" ?

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:09
    Carlos
    0

    I tried that. Do I need to turn something on in a .config to get the debug trace?

     

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:14
    Carlos
    0

    Yep. I may have found something in Red

    Master template is the same as the current template. It would cause an endless loop! Make sure that the current template ''Template with id: '-1' has another Master Template than itself. You can change this in the template editor under 'Settings'

     

     that is all I found though

     

     

     

     

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 02, 2012 @ 22:23
    Rodion Novoselov
    0

    Nevermind - it's a strange error that happens sometimes (I don't know why but I haven't seen any problem with it - probably it's just a bug). Back to the macro - try to check what's the raw value of the bodyText (inside umbraco.config and particulary of course this <?UMBRACO_MACRO ...> tag) - some idea is flying around that it might look down there not as expected...

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:32
    Carlos
    0

    Yeh, there is nothing really out of the ordinary. I can see the tag of <?UMBRACO_MACRO ...>  We have a few other ones using a simlar syntax but they are rendering fine on the other pages.  I will not worry about it for right now. I will try a few different things.  I am not sure why this one is having some issues. Might be on my end.

    Thanks for the help!

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:39
    Carlos
    0

    I know what I did.  I completely bypassed the checking off of the macro to use in editor.

    I just assumed taking some other code and plugging it in the RTE would work. This is user/developer error.

    I feel not so smart.  But I found out why though.

  • Carlos 338 posts 472 karma points
    Feb 02, 2012 @ 22:46
    Carlos
    0

    Nevermind, I am still wrong.  Still doing the same thing. Oh well. I am not too concerned about it right now.  

Please Sign in or register to post replies

Write your reply to:

Draft