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

make the parent page unclickable from the drop down menu


Reply

6 Posts   880 Views

Avatar
phokki

30 May 2012 at 7:34pm Community Member, 14 Posts

Hello guys!

I want to disable the parent page from the drop down menu (navigation).
Lets say that this is my menu.

Home | News | Information | Matches | Photos | Contact

When I hover with my mouse on Information, there comes a drop down menu, with a couple of childs.. ( see attached file)
So i want to disable (unclickable or whatever) the INFO from the drop down, but you can click on childs...

Thanks already :)

Attached Files
Avatar
3dgoo

31 May 2012 at 6:21pm Community Member, 133 Posts

Say this is your Navigation code:

<ul class="mainMenu">
<% control Menu(1) %>   
   <li class="liMainMenu">
      <a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode aMainMenu">$MenuTitle.XML</a>
      <% if children %>
         <ul class="subMenu1">
            <% control children %>
               <li class="liSubMenu1"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode aSubMenu1">$MenuTitle.XML</a></li>
            <% end_control %>
         </ul>
      <% end_if %>
   </li>
<% end_control %>
</ul>

You would want to change it to this:

<ul class="mainMenu">
<% control Menu(1) %>   
   <li class="liMainMenu">
      <% if children %>
         <span class="$LinkingMode aMainMenu">$MenuTitle.XML</span>
         <ul class="subMenu1">
            <% control children %>
               <li class="liSubMenu1"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode aSubMenu1">$MenuTitle.XML</a></li>
            <% end_control %>
         </ul>
      <% else %>
         <a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode aMainMenu">$MenuTitle.XML</a>
      <% end_if %>
   </li>
<% end_control %>
</ul>

Avatar
knrd

31 May 2012 at 10:48pm Community Member, 9 Posts

Hi Guys,

I'm also trying to achieve this as well. I am very new to Silverstripe.

My navigation code is:

<ul id="Menu1">
   <% control Menu(1) %>
      <% if Children %>
         <li class="top $LinkingMode"><a href="$Link" class="top_link" title="View more info about $Title"><span>$MenuTitle</span></a>
            <ul class="sub1">
               <% control Children %>
                  <li><a href="$Link" title="View more about $Title" class="fly $LinkingMode">$MenuTitle</a></li>
               <% end_control %>
            </ul>
         </li>
      <% else %>   
         <li class="top $LinkingMode"><a href="$Link" class="top_link" title="View more info about $Title"><span>$MenuTitle</span></a></li>
      <% end_if %>
   <% end_control %>
</ul>

I have multiple child menu's for different parent pages but only want to disable the parent of 1 of them. Thanks, been trying for hours. Being new to this it might be a lot simpler than I realise.

Avatar
phokki

31 May 2012 at 11:18pm Community Member, 14 Posts

Thanks it worked for me!

@knrd you have to delete <a href="$Link" class="top_link" title="View more info about $Title"> and </a>...

This is mine now:

<div id="navigation_row"> &nbsp; </div>

<!-- [if IE6]><div id="IE6"><![endif]-->
<ul id="menu_list">
   <% control Menu(1) %>
      <% if Children %>
         <li class="top $LinkingMode">
            <span class="top_link" title="$Title">$MenuTitle</span>
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul class="sub1">
             <% if ClassName != NewsArticleHolder %>
               <% control Children %>
                  <li><a href="$Link" title="$Title" class="fly $LinkingMode" <% if is_a(RedirectorPage) %><% if RedirectionType = External %>target="_blank"<% end_if %><% end_if %>>$MenuTitle</a></li>
               <% end_control %>
            <% end_if %>   
            </ul>
            <!--[if lte IE 6]></td></tr></table></a><![endif]-->
         </li>
      <% else %>   
         <li class="top $LinkingMode"><a href="$Link" class="top_link" title="$Title"><span>$MenuTitle</span></a></li>
      <% end_if %>
   <% end_control %>
</ul>
<!-- [if IE6]></div><![endif]-->

I hope you'll solve it :)

Avatar
3dgoo

4 June 2012 at 1:18pm Community Member, 133 Posts

knrd, one thing you could do is in the CMS make that parent page a redirector page, and redirect it to the first child.

Avatar
knrd

6 June 2012 at 11:31am Community Member, 9 Posts

Thanks very much. Ampedup that sounds like the best solution. Will see how I go.