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.

All other Modules /

Discuss all other Modules here.

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

Problem With Superfish Menus


Reply


4 Posts   607 Views

Avatar
weisdaclick

Community Member, 21 Posts

20 March 2012 at 11:42am

I just cannot get this working.

I have installed the Superfish module - nothing shows up when I run the /dev/build so I have no idea if it is correctly installed.

I have found crumbs here and there of how to implement superfish menus and I have tried them all but nothing seems to work.

The README says:

Installation Instructions
-----------------------------------------------
1. Find out how to add modules to SS and add module as per usual. - I am assuming directory name superfish ????

2. copy configurations from this module's _config.php file into mysite/_config.php

When I open the supplied _config.php file I see this:

//copy the lines between the START AND END line to your /mysite/_config.php file and choose the right settings
//===================---------------- START superfish MODULE ----------------===================
//SuperFish::include_code(); // ADD to Page.init() function NOT mysite/_config.php

This seems like lines 1 and 3 give conflicting advice so I have no idea what to do.

Perhaps someone can tell me how this is done (in a noob's way) or point me to a guide on how to do it.

Avatar
weisdaclick

Community Member, 21 Posts

22 March 2012 at 3:47am

Followed this post http://www.silverstripe.org/general-questions/show/7703

Did what Nick Jacobs said here:

In Page.php

Requirements::javascript('js/superfish.js');
Requirements::css('css/superfish.css');
Requirements::css('css/superfish-navbar.css');

Navigation.ss

<ul id="topmenu" class="sf-menu sf-navbar">

<% control Menu(1) %>

<li <% if LinkOrSection = section %>class="current"<% end_if %>><a href="$Link" >$MenuTitle</a>
<% if Children %>
<ul>
<% control Children %>
<li class="$LinkingMode"><a href="$Link" >$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>

<% end_control %>

</ul>

in Page.ss

$(document).ready(function(){

$("ul.sf-menu").superfish({
pathClass: 'current',
autoArrows: false,
dropShadows: false ,
pathLevels: 3

});
}

Just doesn't work for me, completely out of ideas.

Avatar
martimiz

Forum Moderator, 1105 Posts

24 March 2012 at 9:26am

Where did you placed your Requirements? In the Page_Controller init() functionI guess? Can you check your source HTML if the files are actually loaded? The paths don't seem quite right to me: you need to calculate them from the website root:

So if you have your superfish.js file somewhere like in /superfish/js/superfish.js, then your requirement should be something like

Requirements::javascript('superfish/js/superfish.js');

same goes for the other files..

Avatar
weisdaclick

Community Member, 21 Posts

26 March 2012 at 1:28pm

martimiz I was not actually using those paths, that was an excerpt from Nick Jacobs' response.

However you did give me the answer - for a 'belt and braces' approach I used the absolute paths for those requirements, I forgot SS adds the 'home' path by default.

Once I looked at the page source and corrected the paths I got it working!

Thanks so much!