active_class not working when using fuel_nav()

edited September 2011 in Bug Reports
Hello,

I have noticed this on more than one website that I have built with Fuel. I have code that generates a navigation structure that looks like this:

<?php echo fuel_nav(array('group_id' => 'Primary', 'active_class' => 'on')); ?>

Pretty standard setup, only catch is that the "active_class" part doesn't seem to work at all. I have another Fuel site that this is working on, so I have seen it work before, I'm just wondering why its not consistently working on all of my fuel sites. Actually, if you go here and view the source in Firebug:

http://nycitybikeshare.com/how-it-works

You'll notice that there is a nav id=main with a UL that is generated by the fuel_nav() function. Notice how it loads in the first and last attributes, but not the active_class attribute. What could be going wrong?

Oh, and FYI, I cloned the latest version of Fuel yesterday, and I'm noticing that problem happening with the website I'm working on with that cloned copy, so I have the most up-to-date version of it.

Erik

Comments

  • edited 6:18AM
    Can you post the $nav array values, or is it in the admin?
  • edited 6:18AM
    All of the navigation is stored in the DB, in the admin area. You just made me realize that on the website that is working, all of the navigation produced by the fuel_nav function are actually all controller files whereas on the sites where this problem is occurring, they are all stored in the admin.

    Let me know what may be done to get these navigation items stored in the DB in line with the controller-based ones.

    Thanks
  • edited 6:18AM
    What are the values in the DB for the how-it-works navigation item (e.g. location, parent, and nav_key in particular)? Also, can you test if the active is being set for the navigation by checking the $active value on line 379 in the fuel/modules/fuel/helpers/fuel_helper.php file? I'm wondering if it has something with the group_id.
  • edited 6:18AM
    location: how-it-works
    nav_key: how-it-works
    parent_id: 0
  • edited September 2011
    Regarding the testing, I'm not sure how I would go about that. I develop in Aptana Studio 3, which has a built-in debugger, but I haven't ever been keen on using them before, and I'm not even sure how I would get it to work with Fuel. What do you use to perform this kind of test?
  • edited 6:18AM
    You can just echo it out in the code is the easy way.
  • edited 6:18AM
    Any luck with this issue?
  • edited 6:18AM
    Just doing an echo print_r($active) line after line 379 gives me this at the top of the screen:

    Array ( [id] => 1 [group_id] => 1 [location] => how-it-works [nav_key] => how-it-works [label] => How It Works [parent_id] => 0 [precedence] => 2 [attributes] => [selected] => [hidden] => no [published] => yes [group_name] => Primary ) 1

    In this example, the page that is actively loaded is called "how-it-works"
  • edited 6:18AM
    You mind sending me the SQL dump of your fuel_navigation table (email is in my profile)?
  • edited 6:18AM
    I found the issue and just posted a fix. If you change Primary to the number 1 (not a string), it will work. Or you can download the latest:
    https://github.com/daylightstudio/FUEL-CMS/commit/28584e7d604d631ef0c123cd4357373c863985d1
Sign In or Register to comment.