Copied to clipboard

Flag this post as spam?

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


  • Peter Drayton 29 posts 49 karma points
    Dec 21, 2011 @ 12:44
    Peter Drayton
    0

    Using RenderMacroContent and MacroContainers on Umbraco v 4.7.1

    Hi,

    I am trying to use the RenderMacroContent on Umbraco v4.7.1 but it is not working:

    This is my code:

    <xsl:template match="/">  
      
      <xsl:variable name="data" select="umbraco.library:GetXmlNodeById(1129)"/>
      <xsl:for-each select="$data">
        <xsl:value-of select="umbraco.library:RenderMacroContent(./sidebarModules, ./@id)" disable-output-escaping="yes"/>
      </xsl:for-each>
    </xsl:template>

    </xsl:stylesheet>


    I have output the XML returned it is is correct, but has <?UMBRACO_MACRO macroAlias="Name" runat="server"></?UMBRACO_MACRO> and not <umbraco:Macro Alias="Name" runat="server"></umbraco:Macro>

    How do I get this working?

     

    Many thanks,

     

    Peter.

  • Peter Drayton 29 posts 49 karma points
    Dec 21, 2011 @ 13:57
    Peter Drayton
    0

    The XML returned is:

    <?UMBRACO_MACRO  macroalias="Macro1"  /><?UMBRACO_MACRO  macroalias="Macro2"  />

    So WHY is nothing output?

  • awm 187 posts 376 karma points
    Dec 21, 2011 @ 13:58
    awm
    0

    shouldn't it have runat="server"?

  • Peter Drayton 29 posts 49 karma points
    Dec 21, 2011 @ 14:53
    Peter Drayton
    0

    It should, but that is what the XML is output as?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 21, 2011 @ 15:02
    Tom Fulton
    0

    Hi,

    That looks correct.  Are these by chance .NET macros you are trying to render from XSLT?  If so unfortunately that is not supported, pretty sure you can only render XSLT Macros from XSLT.

    -Tom

  • Peter Drayton 29 posts 49 karma points
    Dec 21, 2011 @ 15:18
    Peter Drayton
    0

    Hi Tom,

     

    Yes, once of the modules inside the Macro Container is a .NET Macro

    Basically what I'm trying to achieve is this:

    I have a <umbraco:Item field="sidebarModules" recursive="true" runat="server" /> in the Master Template, however on the "DateFolder" pages,

    I need to show the sidebarModules from another node.

    sidebarModules is a Macro Container.

    I don't know if there is an alternative solution to acheiveing this?

    Peter.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 21, 2011 @ 15:24
    Tom Fulton
    0

    Hmmm, that might be tricky.

    One thing you could experiment with is the nodeId attribute on the <umbraco:Item tag, ex:

    <umbraco:Item field="sidebarModules" recursive="true" runat="server" NodeId="1234" />

    This *should* cause the macro to render but using data from the node 1234.  However I'm not sure if you can pass that in dynamically or not, maybe you can with some inline C#  NodeId='<%=something%>' ...

    -Tom

  • Peter Drayton 29 posts 49 karma points
    Dec 21, 2011 @ 15:45
    Peter Drayton
    0

    Tom,

     

    You're a star. Simply adding NodeID="xxx" worked :-)

Please Sign in or register to post replies

Write your reply to:

Draft