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.

Archive /

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

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

Limiting Menu Controller returns


Go to End


3 Posts   1884 Views

Avatar
camspiers

Community Member, 5 Posts

1 July 2008 at 4:57pm

Edited: 01/07/2008 4:59pm

Hi,

I have had a look through the forums and doc and tried to find a solution but haven't.

I want to limit the number of pages retuned from the Menu controller.

Is this a desirable thing to do? I have first level pages which I do not want to appear in the Main Navigation, such as News and a Custom holder for some JavaScript Slide Menus that advertise interesting pages on the site.

At the moment I simply unselect the ShowInMenus option in the CMS, but as people editing the site might make a mistake I would like to safeguard this mistake.

So I want to do something like <% control Menu($level, $limit) %>

Thanks for your help in advance.

Oh and the menu for the site is designed to only have 5 items(by choice).

Cameron Spiers.

Avatar
Willr

Forum Moderator, 5523 Posts

1 July 2008 at 5:18pm

At the moment I simply unselect the ShowInMenus option in the CMS, but as people editing the site might make a mistake I would like to safeguard this mistake.

You could make the default setting 'ShowInMenus' false so its turned off by default - in case of people creating a page, then at least they have to go enable it.

Avatar
camspiers

Community Member, 5 Posts

1 July 2008 at 10:30pm

Edited: 01/07/2008 10:31pm

Thanks willr.
Yes, I can do that and have already done it for top level pages. But I would still like to stop any possibility of a admin user creating a new top level page with the showinmenus option on.
It seems like a simple thing to do. Well, if someone has done this before it would be appreciated.
Cheers.