Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » make the parent page unclickable from the drop down menu

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: 859 Views
  • phokki
    Avatar
    Community Member
    14 Posts

    make the parent page unclickable from the drop down menu Link to this post

    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
  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: make the parent page unclickable from the drop down menu Link to this post

    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>

  • knrd
    Avatar
    Community Member
    9 Posts

    Re: make the parent page unclickable from the drop down menu Link to this post

    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.

  • phokki
    Avatar
    Community Member
    14 Posts

    Re: make the parent page unclickable from the drop down menu Link to this post

    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

  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: make the parent page unclickable from the drop down menu Link to this post

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

  • knrd
    Avatar
    Community Member
    9 Posts

    Re: make the parent page unclickable from the drop down menu Link to this post

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

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