Jump to:

23001 Posts in 11702 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » Menu groupings or Menu items with no link?

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

Page: 1
Go to End
Author Topic: 1033 Views
  • Johan
    Avatar
    Community Member
    49 Posts

    Menu groupings or Menu items with no link? Link to this post

    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
  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Menu groupings or Menu items with no link? Link to this post

    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.

    1033 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.