Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Find parents of nested menu items

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1370 Views
  • MattKenefick
    Avatar
    Community Member
    13 Posts

    Find parents of nested menu items Link to this post

    If this is the menu tree I have in the cms...

    Content

    ..home
    ..
    ..browse
    ..-> pictures
    ..-> -> gallery1
    ..-> -> gallery2
    ..
    ..-> videos
    ..-> -> gallery1

    When I'm in gallery1, I obviously want my breadcrumbs to read " home > browse > pictures > gallery1 " but I feel it's not setup to do that based on the friendly-url design :-\ .

    But my question is.. My main nav reads "Home - Browse - ... etc" .. When I'm in the "Browse" section, the nav highlights to let you know where you are. But, when I go deeper into that section, it doesn't realize it's in Browse anymore.

    Is there a built in way to determine the furthest parent of a nested item? I need it to realize that gallery1 is a grandchild of "Browse". And also a direct child of "Pictures" would be nice too.

    Thanks!

    And if you have a solution to the breadcrumbs above, I'm all ears. I could use the DataObject::get but I don't know if I wanna run a separate query on every page-load if it's already happening somewhere.

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Find parents of nested menu items Link to this post

    Go to

    http://doc.silverstripe.com/doku.php?id=built-in-page-controls

    The 'Links and Class' paragraph should help you...

  • MattKenefick
    Avatar
    Community Member
    13 Posts

    Re: Find parents of nested menu items Link to this post

    no that doesn't really help
    --------------------------

    EDIT: Actually, I jumped the gun. The <% if InSection(recipes) %> works. I was using it improperly at first.

    1370 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.