Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 886 posts 2415 karma points
    Dec 09, 2014 @ 13:24
    Claushingebjerg
    0

    AncestorOrSelf()... How to use correctly?

    I have a multi node tree picker in my footer.

    I want to list the selected nodes if they are defined on the currentPage or one of it ancestors.

    @foreach(var id in CurrentPage.AncestorOrSelf(2).footerLinks.Split(','))
    {
        var content = Umbraco.Content(id);
      <a href="@content.Url" class="footerlink">@content.Name</a>  
    }

    But it doenst really work. It seems like it goes all the way to level 2 and takes the defined "footerlinks" from there. Even if they are defines on CurrentPage?

    Any pointers on how to do this correctly?

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Dec 09, 2014 @ 13:26
    Dennis Aaen
    100

    Hi Claus,

    What if you are doing it like this

    @foreach(var id in CurrentPage._footerLinks.Split(','))
    {
        var content = Umbraco.Content(id);
      <a href="@content.Url" class="footerlink">@content.Name</a>  
    }

    Hope this helps,

    /Dennis

  • Claushingebjerg 886 posts 2415 karma points
    Dec 09, 2014 @ 13:30
    Claushingebjerg
    0

    Yup, that looks like it does the trick :), Thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies