Copied to clipboard

Flag this post as spam?

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


  • Ronnie Overby 14 posts 37 karma points
    Sep 06, 2012 @ 22:46
    Ronnie Overby
    0

    Using a macro in my page template STOPS page contents from rendering

    Here is the relevant markup in my Page template:

          <!-- SIDE NAV:
               The sideNav property is an ultimate picker value. 
               The value is the id of a SideNaveMenu document.
               When I include this macro in the template, the contents field below
               doesn't render anything!
          -->      

    <umbraco:Macro runat="server" language="cshtml">    
          @Html.Raw(umbraco.library.RenderTemplate(int.Parse(Model.sideNav)))
    </umbraco:Macro>   


          <!-- CONTENTS:
               RichTextEditor field      -->
    <umbraco:Item field="contents" runat="server" />

     

    Please help.

  • Drew 165 posts 340 karma points
    Sep 06, 2012 @ 23:11
    Drew
    0

    Add "?umbDebugShowTrace=true" to the URL of a page that is failing and scroll down to see if any errors are thrown.

    Example: www.mysite.com/about/my-broken-page?umbDebugShowTrace=true

     

    Cheers,
    Drew 

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 07, 2012 @ 08:01
    Chriztian Steinmeier
    0

    Hi Ronnie,

    Are you sure it doesn't render somewhere - have you tried searching the "View Source" (*not* Web Inspector/Firebug - the actual source) for the contents?

    E.g. if there's a tag that's not being closed correct from the @Html.Raw() output - the rest of the page could very easily be effectively "hidden"...

    /Chriztian

  • Ronnie Overby 14 posts 37 karma points
    Sep 10, 2012 @ 16:10
    Ronnie Overby
    0

    @Drew - That doesn't add any additional output.

    @Chriztian - No, the HTML is not being rendered at all.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 10, 2012 @ 21:32
    Chriztian Steinmeier
    0

    Hi Ronnie,

    Does the sideNav document have a template defined? Otherwise, you might need to supply a templateId as the 2nd argument:

    <umbraco:Macro runat="server" language="cshtml">
          @Html.Raw(umbraco.library.RenderTemplate(int.Parse(Model.sideNav), TemplateId))
    </umbraco:Macro

    /Chriztian 

  • Ronnie Overby 14 posts 37 karma points
    Sep 11, 2012 @ 03:08
    Ronnie Overby
    0

    Yes, Chriztian, it does and it works. The issue isn't that the side nav doesn't show up. 

    The problem I'm having is that when I include that inline macro, it causes the page field called contents to stop being rendered.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 11, 2012 @ 08:09
    Chriztian Steinmeier
    0

    Hi Ronnie,

    Pardon my "cleverness" - I got tangled up in the RenderTemplate() stuff and forgot the initial question :-)

    So what I could imagine *might* be happening, is that the RenderTemplate() somehow makes the Item tag look for the contents property on the page you passed to RenderTemplate()? Does that make sense? Could you try swapping "contents" with the name of a field on the sideNav document and see if that's the case?

    Admittedly it would be a weird bug, but hey - it's a computer program :-)

    /Chriztian

  • Ronnie Overby 14 posts 37 karma points
    Sep 11, 2012 @ 14:25
    Ronnie Overby
    0

    It's a wierd and buggy computer program.

    I'll check into that today...

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft