Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Problem With Superfish Menus

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 565 Views
  • weisdaclick
    Avatar
    Community Member
    21 Posts

    Problem With Superfish Menus Link to this post

    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.

  • weisdaclick
    Avatar
    Community Member
    21 Posts

    Re: Problem With Superfish Menus Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: Problem With Superfish Menus Link to this post

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

  • weisdaclick
    Avatar
    Community Member
    21 Posts

    Re: Problem With Superfish Menus Link to this post

    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!

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