Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

Find parents of nested menu items


Reply


3 Posts   1445 Views

Avatar
MattKenefick

Community Member, 13 Posts

28 August 2008 at 3:52am

Edited: 28/08/2008 3:55am

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.

Avatar
SilverRay

Community Member, 167 Posts

28 August 2008 at 4:27am

Go to

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

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

Avatar
MattKenefick

Community Member, 13 Posts

28 August 2008 at 8:21am

Edited: 28/08/2008 8:24am

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

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