Copied to clipboard

Flag this post as spam?

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


  • Max Davidse 16 posts 37 karma points
    Mar 30, 2011 @ 11:19
    Max Davidse
    0

    Problem with umbracoNaviHide

    Hi,

    This is my first ever post on the umbraco forums, but I've started using it only recently, so there ya go.

    I'm working on the navigation for a site that I am building using Umbraco 4.7 using razor (I simply hate XSLT) yet somehow the menu will always show the items that I hide using "Hide in Menu"

     

    The razor script I am using is as follows.

    <ul class="navigation">
    @foreach (var c in currentPage.Children.Where("umbracoNaviHide!=true"))
    {
    if (c.Id == activePage.Id)
    {
    <li><a href="@c.Url">@c.Name</a><div class="active"></div></li>
    }
    else
    {
    <li><a href="@c.Url">@c.Name</a></li>
    }
    }
    </ul>
    }

    I will be gratefull if you can help me fix this. :)

  • Max Davidse 16 posts 37 karma points
    Mar 30, 2011 @ 11:34
    Max Davidse
    1

    Fixed this!

    Got some fast responses on Twitter, but they couldn't know that jbreuer here, added an extra property to divide hide in sitemap and hide in menu, so I had to check another property. So now using

    currentPage.Children.Where("hideInMenu != true)

    it works like a charm!

    Thanks to everyone that tied to help.

Please Sign in or register to post replies

Write your reply to:

Draft