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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Menu groupings or Menu items with no link?


Reply


2 Posts   1155 Views

Avatar
Johan

Community Member, 49 Posts

9 April 2010 at 2:30am

Edited: 09/04/2010 8:12pm

This is a realistic scenario. Is it possible to create menu items that have no link or content?

This type of item is often used with JS to mouse over to reveal a second level menu items without being a link to any content in the CMS but may require class so that an <a> tag (with response none) can be added with JS to enable keyboard navigation for tabbing in the menu to work.

It is also used to simply group menu options and should have the option to include or not include <a> tag.

If not what is the best work around?

If I am not explaining this very well the modified example attached may clear things up.

Attached Files
Avatar
Willr

Forum Moderator, 5513 Posts

11 April 2010 at 1:18pm

What I normally do to get this working is use a RedirectorPage to group the entries then in the template if the classname is a RedirectorPage then don't include the link. The RedirectorPage can link off to either the homepage or another page (I use it as its included by default and won't leave random pages on the site).

<% control Children %>
<% if ClassName = RedirectorPage %>$MenuTitle<% else %><a href="$Link">$MenuTitle</a><% end_if %>
<% end_control %>

Or you could group the pages under the redirectorpage.