Copied to clipboard

Flag this post as spam?

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


  • Paul Marden 235 posts 338 karma points MVP c-trib
    Oct 08, 2009 @ 18:08
    Paul Marden
    0

    Macro Rendering in RTE but not in Site

    I have a simple XSLT macro which just outputs a line of text (trying to go for a simple test case to prove my problem).

    The macro has use in Editor selected.  I can insert the macro in to a RTE field on a node, add parameters to it, and it gets inserted into the RTE and the line of text renders in the RTE.

    When I publish the page the macro doesn't seem to execute at all what gets output to the page when it's executed is

    <?UMBRACO_MACRO numbertolist="3"
    macroAlias="LatestCountryLinks" source="1347" />

    Which obviously isn't right.

    Running Umbraco 4.0.1.2 on Win2003 Web Edition, ASP.net 2.0.50727.

     

  • dandrayne 1138 posts 2262 karma points
    Oct 08, 2009 @ 18:19
    dandrayne
    0

    That looks like version 3 macro code, which is strange. Try popping it straight into your template using the code above and see what you get, then try this in your template

    <umbraco:Macro Alias="LatestCountryLinks" numbertolist="3" source="1347" runat="server"></umbraco:Macro>

    It looks like you're somehow getting v3 macro code, which would explain why it's not being rendered properly.  Not sure why though..  was this site an upgrade or a fresh install?

    Dan

  • Paul Marden 235 posts 338 karma points MVP c-trib
    Oct 08, 2009 @ 18:23
    Paul Marden
    0

    Pretty certain it was a fresh install of v4.0.1.2.  Very strange.

    Anyway I can't paste that straight in, as I'm inserting the macro in the RTE.  In the Editor source code I see

    <div class="umbMacroHolder" title="This is rendered content from macro" umbpageid="1782" umbversionid="9d4abf9a-675f-454c-8db3-7b514c4e4530" onresizestart="return false;" ismacro="true" umb_macroalias="LatestCountryLinks" umb_source="1347" umb_numbertolist="3"><!-- startUmbMacro -->My Latest Links<!-- endUmbMacro --></div>

    What's being output to the browser is

    <?UMBRACO_MACRO numbertolist="3"
    macroAlias
    ="LatestCountryLinks" source="1347" />

    So the upshot is, I can't insert your macro code into the RTE because TinyMCE or Tidy is stripping it out.

  • dandrayne 1138 posts 2262 karma points
    Oct 08, 2009 @ 20:38
    dandrayne
    0

    I meant you could put the two types of macro code straight into the template (copy & pasting from the forum) and see which one renders content, but that doesn't solve the problem.

    A quick dig on this reveals http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21728 and http://forum.umbraco.org/yaf_postst8677_XSLT-Macro-not-rendering-to-page.aspx, but unfortunately it looks like there isn't currently a solution.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 08, 2009 @ 20:44
    Kim Andersen
    0

    Hi Paul!

    What do you use for rendering your RTE-field? Do ypu use XSLT to render the field, or how do you do it?

  • Paul Marden 235 posts 338 karma points MVP c-trib
    Oct 09, 2009 @ 10:18
    Paul Marden
    0

    Kim the field is being output from an XSLT macro which is called from the template.

  • dandrayne 1138 posts 2262 karma points
    Oct 09, 2009 @ 16:05
    dandrayne
    0

    Arrgh.  I just ran up against this today with a live client site.  it seems to only appear when rendering a RTE field via xslt and disable-output-escaping.  changing to just using a page field fixed it. ie using

    <umbraco:Item field="pageContent" runat="server"></umbraco:Item>

    In the template, instead of

    <xsl:value-of select="$currentPage/data [@alias='pageContent']" disable-output-escaping="yes" />

    In an xslt macro

    Hope this helps,
    Dan

     

  • Paul Marden 235 posts 338 karma points MVP c-trib
    Oct 09, 2009 @ 16:53
    Paul Marden
    0

    Dan -- That's a good workaround but is no good for me.  I've got other stuff in the XSLT macro doing stuff that can't be done in a template.  I'll update the bug in codeplex with your findings.

    P

  • dandrayne 1138 posts 2262 karma points
    Oct 09, 2009 @ 17:49
    dandrayne
    0

    I'd need to find a repeatable case, cos the bug didnt appear for all my macros (just the most important one... go figure) when all were rendered via xslt.  There must be something in the particular macros that cause the issue, and finding a clear test case would speed up the patch process

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 10, 2009 @ 12:50
    Kim Andersen
    2

    Paul.

     

    I have used this in earlier projects to render macroes in the RTE through XSLT:

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

    This will show the macro (and the rest of the content in the RTE of course ;) ) on the frontend, and is rendered through XSLT. Try it out :)

  • Stephan Lonntorp 195 posts 212 karma points
    Oct 10, 2009 @ 17:57
    Stephan Lonntorp
    0

    I don't know if this solves your issue, but when I have macros that are to be inserted in the RTE, any parameter names must be in all lowercase, since Tidy will change all your attributes to lowercase to conform to xhtml.

    As I said, I have no idea if this relates to your problem, but it's one of those "good to know" things.

     

    //S

  • Paul Marden 235 posts 338 karma points MVP c-trib
    Oct 12, 2009 @ 14:52
    Paul Marden
    0

    Stephan - thanks for the advice but all attributes are lowercase already.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 15, 2009 @ 13:02
    Kim Andersen
    0

    Did you try out the:

    umbraco.library:RenderMacroContent

    Paul?

  • MayMay 7 posts 26 karma points
    Oct 15, 2009 @ 22:33
    MayMay
    0

    I have the same problem.

    I tried:

       <xsl:variable name="content" select="$currentPage/data [@alias='pageBody']" />
       <xsl:value-of select="umbraco.library:RenderMacroContent($content, $currentPage/@id)" disable-output-escaping="yes"/>

     

    Then insert a macro (hello) in the editor and add a parameter (value: "Value setting in the editor") to it. The marco gets inserted into the RTE and the line of text renders in the RTE as: 

    10/15/2009 4:23:49 PM
    Value setting in the editor.

    When I publish the page the macro outputs only static content ("Hello World !") and seems Page_Load() didn't excute at all.

     

    Macro hello:

    <%@ Control Language="C#" AutoEventWireup="true" %>

    <script runat="server">
       private string _name;
       public string name
       {
         get { return _name;}
         set { _name = value; }
       }
       protected void Page_Load(object sender, EventArgs e)
       {
           Label1.Text = DateTime.Now.ToString() + "<br />" +  name ;
       }
    </script>
    <asp:Label ID="Label1" runat="server" Text="Hello World !"></asp:Label>

     

     

  • Jacob Jensen 29 posts 49 karma points
    Oct 16, 2009 @ 11:07
    Jacob Jensen
    0

    i dont think you can fire .net usercontrols in a xslt rendering

    inline c#, and xslt extensions, but not usercontrols.

  • MayMay 7 posts 26 karma points
    Oct 16, 2009 @ 17:27
    MayMay
    0

     It seems fire when i take a look on trace:

    template Begining of parsing rutine... 0.016103443314723 0.000168
    umbTemplate Outputting item: <?UMBRACO_MACRO name="Value setting from rte."
    macroAlias="Hello" />
    0.0163101734997046 0.000207
    template Begining of parsing rutine... 0.0164160528782289 0.000106
    umbracoMacro Macro loaded from cache (ID: 19, Hello) 0.0165096401917003 0.000094
    renderMacro Rendering started (macro: Hello, type: 3, cacheRate: 0) 0.0165657925797832 0.000056
    umbracoMacro Usercontrol added (/usercontrols/hello.ascx) 0.0166515576700391 0.000086
    loadUserControl Usercontrol added with id 'hello_4' 0.016988751363651 0.000337
    macro.loadControlProperties Property added 'name' with value 'Value setting from rte.' 0.0170756339143662 0.000087
    umbracoMacro After performing transformation
Please Sign in or register to post replies

Write your reply to:

Draft