Navigation Groups

edited December 2010 in Bug Reports
This is in 0.91 from this morning.

The group_id seems to get ignored if it has no parents.

I have two groups: Root (holds most items) id of 1 and Footer (few double ups with root, sitemap, legal etc) id of 2.

Both have no parents.

Using:

[code]
$options = array('container_tag' => 'div',
'container_tag_id' => 'footerNav',
'use_titles' => true,
'group_id' => 2);

echo fuel_nav($options);
[/code]

It returns everything in both groups because it runs $CI->navigation_model->find_all_array(); on line 327 of fuel_helper.

I thought it may have been due to the fact that the double ups share the same location. Changed the values, problem persist.

Thought I'd also mention that on creation you can duplicate the locations between groups. On edit it flags an error. There is a number of comments about items may have duplicate locations in the code so why the error on edit?

Comments

  • edited December 2010
    Kinda off topic a bit but the menu class behaves a bit out of (my) expectations.

    I need a horizontal list. I could have an inline < ul > for sure. But since I can set the container_tag and item_tag for the list (so DIV and '') I figured it would drop the item tag wrappers off. Instead it encapsulated with empty <>.. so close to behaving.

    I've got around it by using spans which works fine.
  • edited December 2010
    If you change line 327 to the following, does it fix your problem?
    $menu_items = $CI->navigation_model->find_all_array(array('group_id' => $p['group_id']));
  • edited 10:54PM
    There was a another issue in that function I noticed with regards to passing a parent value which I've fixed and posted to GitHub. I also posted a fix for the empty menu items.
  • edited December 2010
    Awesome cheers.

    Wonder if it would be worthwhile to others to be able to send fuel_nav the group name instead of id? I had to look in the db to see what the id of the groups were.

    I did this to make it happen:


    Fuel Helper, around 322

    if ( ! is_numeric($p['group_id']))
    {
    $p['group_id'] = $CI->navigation_model->get_group_id_by_name($p['group_id']);
    }



    And in navigation_model:


    function get_group_id_by_name($name)
    {
    $this->db->select($this->_tables['navigation_groups'].'.id');
    $query = $this->db->get_where($this->_tables['navigation_groups'], $this->_tables['navigation_groups'].'.name = "'.$name.'"');

    if ( ! $id = $query->row('id'))
    {
    # default
    return 1;
    }
    else
    {
    return $id;
    }
    }
  • edited 10:54PM
    that is a good idea... I'll look into changing that.
Sign In or Register to comment.