Copied to clipboard

Flag this post as spam?

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


  • Bill 43 posts 65 karma points
    Jul 09, 2012 @ 17:09
    Bill
    0

    RenderMacroContent

    Hi, I'm in the process of converting a load of old xslt into razor and I'm having some trouble running an xslt macro from within a razor file:

    @using umbraco.MacroEngines 
    
    @RenderPage("~/macroscripts/ModuleImpressionsM5.cshtml");   
    @umbraco.library.RenderMacroContent("Modules", Model.Id);

    The first statement sucessfully executes the code within ModuleImpressionsM5.cshtml

    The second statement is supposed to render out an old xslt macro, with alias 'Modules'. However, the xslt macro doesn't render and instead, the word 'Modules' is simply written to the page. In fact, whatever is written as the 'MacroAlias' property of RenderMacroContent is just written directly to page. FYI - Wrapping the output in Html.Raw() makes no difference.

    Please help!

    Thanks in advance,

    Billy

  • Bill 43 posts 65 karma points
    Jul 09, 2012 @ 17:35
    Bill
    0

    I have tried: 

    @umbraco.library.RenderMacroContent("Modules",Model.Id);

    @umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias="Modules" />", Model.Id)

    @umbraco.library.RenderMacroContent("<umbraco:Macro Alias="Modules" runat="server"></umbraco:Macro>", Model.Id)

    but no luck. I just get the first parameter string written to page. I'm really stuck with this!

    Thanks, 

    Billy

  • Jonas Eriksson 930 posts 1825 karma points
    Jul 09, 2012 @ 19:38
    Jonas Eriksson
    1

    tried:

    umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"macroalias\" ></?UMBRACO_MACRO>", id);

    ?

    http://our.umbraco.org/forum/developers/api-questions/16387-call-and-render-macro-from-base?p=0#comment61064

  • Bill 43 posts 65 karma points
    Jul 10, 2012 @ 10:41
    Bill
    0

    Jonas is a STAR!

    Thanks

    Bill

  • Scott Williams 14 posts 71 karma points
    Jul 10, 2012 @ 11:38
    Scott Williams
    0

    alternativly you could use my pacakge http://our.umbraco.org/projects/website-utilities/razor-components

    it uses a simple RenderPage style syntax to rendering macro from inside other Razor macros.

Please Sign in or register to post replies

Write your reply to:

Draft