Copied to clipboard

Flag this post as spam?

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


  • loic ponchon 36 posts 56 karma points
    Jul 27, 2011 @ 12:23
    loic ponchon
    0

    Top Navigation doesn't display the link

    Hello, i have a razor macro which works

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @using umbraco.MacroEngines
    <ul>
      @foreach(var page in Model.AncestorOrSelf().Children.Where("umbracoNaviHide!=true"))
      {
        <li><a href="@page.Url">@page.Name</a></li>
      }
    </ul>

    I tested it on umbraco cms.

    I created a tree in content Site under content and some page under site.

    Site is my homepage and when i'm on this page, my topnavigation display no one link.

    Can tell me if i missed some step or juste hepl me ^^

    Thank you by advance

  • Nigel Wilson 945 posts 2077 karma points
    Jul 29, 2011 @ 20:31
    Nigel Wilson
    0

    Hi Ioic

    I don't know razor but viewing the following forum post I wonder if you are missing a directive for the level -e.g.

    Model.AncestorOrSelf(1)

     

    http://our.umbraco.org/forum/developers/razor/17829-Razor-Snippet-Top-Navigation-is-Incorrect

    As I say I haven't learnt razor yet but the above is different between your code and the code that is detailed in the above post.

    Hope this helps.

    Nigel

  • Fengelz 106 posts 221 karma points
    Aug 01, 2011 @ 12:58
    Fengelz
    0

    It looks correct (I believe an empty AncestorOrSelf() returns the top node if I'm not mistaken).

    Have you tried printing out the Model.AncestorOrSelf().Name and see what you got there?

    - Sune

  • loic ponchon 36 posts 56 karma points
    Aug 01, 2011 @ 12:59
    loic ponchon
    0

    i made a bad architecture.

    Thank you for your replies

Please Sign in or register to post replies

Write your reply to:

Draft