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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Limiting the display of grandparent/ parents pages in the side menu


Go to End


1330 Views

Avatar
Tama

Community Member, 138 Posts

27 May 2010 at 2:15pm

Edited: 27/05/2010 2:16pm

Hopefully some of you have already tried this method of navigation so I thought I'd put a question up here and save myself from re-inventing the wheel.

Using nested numbers the default menu structure in the left sidebar looks like this if the user is viewing the page "3.3. Page Title":

1. Page Title
2. Page Title
3. Page Title
3.1. Page Title
3.2. Page Title
3.3. Page Title
3.4. Page Title
4. Page Title

This can be extended out to more than levels:
1. Page Title
2. Page Title
3. Page Title
3.1. Page Title
3.2. Page Title
3.3. Page Title
3.3.1. Page Title
3.3.2. Page Title
3.3.3. Page Title
3.3.4. Page Title
3.4. Page Title
4. Page Title

The difficulty with this method is if you have a lot of options (we tend to have 8 children to each parent page) and a deep website structure (5 levels) the vertical size of the menu becomes quite baffling.

The menu display system I'd like to use follows:

3. Page Title
3.3. Page Title
3.3.1. Page Title
3.3.2. Page Title
3.3.3. Page Title
3.3.4. Page Title

So the menu only shows the following:

  • The page
  • The page's siblings
  • The page's parent
  • The page's grandparent
  • The page's great-grandparent
  • etc.

In essence this is similar to breadcrumbs except the page siblings are shown too.

Has anyone take this approach before? Any code examples would be greatly appreciated.

Cheers
Tama