Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 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 4500 posts 18255 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 939 posts 2574 karma points
    Dec 09, 2014 @ 13:30
    Claushingebjerg
    0

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

Please Sign in or register to post replies

Write your reply to:

Draft