Copied to clipboard

Flag this post as spam?

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


  • Gonçalo Assunção 39 posts 68 karma points
    Dec 03, 2014 @ 19:12
    Gonçalo Assunção
    0

    RenderMacroContent renders raw HTML

    Hey guys,

     

    I'm new to Umbraco6, and I am trying to call a xslt macro into a razor file.

    This is what my code looks like:
    @using System.Web
    @using System.Web.Mvc
    @using System.Web.Security
    @using umbraco.MacroEngines

    <div id="renewButtonContainer">
         @umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"RenewSubscriptionButton\" ></?UMBRACO_MACRO>", Model.Id)

    </div>

    The output of this is the following:

    <div class="renewButton">
         <a href="#"><xsl:value-of select="$renewButton" /></a>
      </div>

    instead of the actual "button"...

    I've tried to use the "@Html.Raw(umbraco.library.....) method, but it didn't worked...

    Thank you in advanced

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 03, 2014 @ 19:31
    Jan Skovgaard
    0

    Hi Goncalo (Sorry, don't know how to make the special characters to spell your name 100% correct) and welcome to our :)

    Why are you trying to render the XSLT macro from a Razor based macro? What is your scenario? And could there perhaps be another way around it?

    Sounds like you should just output the XSLT macro directly in a template instead of a macro - And if not then just fetch the needed button value using your Razor macro?

    Looking forward to hearing from you.

    Cheers, Jan

  • Gonçalo Assunção 39 posts 68 karma points
    Dec 04, 2014 @ 10:39
    Gonçalo Assunção
    0

    Hey Jan, Thank you for your anwser!

    Well, I have used this XSLT macro in other pages, so I thought that I could use it in the header of the page, wich is coded in razor.

    The project manager gave me this chalenge, since I am still learning my way around Umbraco and XSLT...

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 04, 2014 @ 10:49
    Jan Skovgaard
    0

    Hi Gonçalo

    Ok, but I suggest that you keep them seperate instead of trying to mix them. It's begging for trouble and time-wasting and I'm not sure it can be done.

    Instead of spending the time doing that I think you're better of by just fetching what you need in the header by using Razor, which it's already using :)

    Cheers, Jan

  • Gonçalo Assunção 39 posts 68 karma points
    Dec 05, 2014 @ 13:25
    Gonçalo Assunção
    0

    Hey Jan,

     

    So I decided to render the button using only razor... It just not worth the effort...

    Oh well... New challenges await... Thank you so much for your help! 

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 05, 2014 @ 13:31
    Jan Skovgaard
    0

    Hi Gonçalo

    Yup exactly, it something that does not make sense anyway so it's better to just use the proper method for the job and move on to new and more rewarding challenges :)

    But please by all means feel free to ask for help if you get stuck with anything once again.

    Have fun Umbracoing!

    Cheers, Jan

Please Sign in or register to post replies

Write your reply to:

Draft