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

Drop Down Menus with Silverstripe


Reply


40 Posts   15292 Views

Avatar
animasola

Community Member, 121 Posts

15 June 2009 at 8:28pm

I also have the same problem and I got what willr posted and implemented it. Problem is, it doesn't work with a child of a child page, like a third level menu. I only goes down once and it doesn't make another list for the children of a level two page. I hope you understand what I'm trying to say.

Any thoughts?

Avatar
hive.net.au

Community Member, 40 Posts

23 June 2009 at 1:04am

Edited: 23/06/2009 1:06am

Hi Animasola,

I have modified the code to produce three levels, you can use the same logic to go to further levels. However i have not written the CSS for this yet. Will post that soon.

<!-- [if IE6]><div id="IE6"><![endif]-->
<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><!--[if gte IE 7]><!--></a><!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul class="sub1">
               <% control Children %>
                  <% if Children %>
<li class="top $LinkingMode"><a href="$Link" class="top_link" title="View more info about $Title"><span>$MenuTitle</span><!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul class="sub1">
               <% control Children %>
<li><a href="$Link" title="View more about $Title" class="fly $LinkingMode">$MenuTitle</a></li>
<% end_control %>
</ul><!--[if lte IE 6]></td></tr></table></a><![endif]-->
         </li>
<% else %>   

<li><a href="$Link" title="View more about $Title" class="fly $LinkingMode">$MenuTitle</a></li>
<% end_if %>
               <% end_control %>
            </ul>
         <!--[if lte IE 6]></td></tr></table></a><![endif]-->
         </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>
<!-- [if IE6]></div><![endif]-->

Thanks to willr for the orginal code

Avatar
hive.net.au

Community Member, 40 Posts

23 June 2009 at 7:00pm

Please find the code attached for a three level drop down menu, thanks to willr for the orginal code and cssmenu.co.uk for the css. Only very slightly changed.

Avatar
Taffy

Community Member, 119 Posts

23 June 2009 at 7:42pm

Nice one. It would be good if you could post it on Aram's http://ssbits.com/ site :)

Avatar
hive.net.au

Community Member, 40 Posts

23 June 2009 at 9:22pm

I will post it up there.

Avatar
DrWebGuy

Community Member, 16 Posts

18 July 2009 at 9:18am

Try as I may, I cannot find the Menu1.css attachment. Has it been removed? Or is there another copy somewhere I could get my hands on?

Avatar
hive.net.au

Community Member, 40 Posts

18 July 2009 at 12:51pm

It used to be there i thought, sorry about that here they are again.

Attached Files
Avatar
DrWebGuy

Community Member, 16 Posts

7 August 2009 at 6:56am

Have you ever had any issues using FireFox with this menu? I LOVE the css menu, but just recently noticed that in Firefox when you move the mouse down over the sub-menu it disappears. I compared the css with the "original" from cssmenu.co.uk line by line and I cannot find the discrepancy. It works fine in every browser on their site, but when it is implemented through Silverstripe on my site it suddenly stops functioning correctly. Oddly enough it works like a dream in Safari and IE8. Any thoughts? I have searched for a solution for days and still no luck.