Fuel navigation : how manually set 'active' item on sub level item menu

edited February 2015 in News & Announcements
Hello guys,
i've to set manually in my controllers active value for menu and sub menu (menu are hardcoded in var.php, not cms).
Works fine in first level menu but i don't know how to proceed for sub menu, any help will be helpful.

Ex : in nav.php

// nav level 1

$top_nav = array( 'adults'=>array('label'=>'adults', 'location'=>'adults' , ),
'juniors'=>array('label'=>'juniors', 'location'=>'juniors'),
'groups'=>array('label'=>'groups', 'location'=>'groups'),
);
// sub item, example for juniors

$top_nav['juniors_school'] = array( 'label' => 'juniors school' , 'parent_id' => 'juniors' , 'location'=>'juniors_school') ;
$top_nav['juniors_courses'] = array( 'label' => 'juniors courses' , 'parent_id' => 'juniors' , 'location'=>'juniors_courses') ;

// my rendering in a block

// -- works fine, my 'juniors item has the active class'
echo $this->fuel->navigation->render( $params=array(
'var' => 'top_nav',
'active'=>'juniors'
));
I would like now that 'juniors' items has the active class, and also the 'juniors_courses' , when i am on 'juniors_courses' page.
I ask just for a tip about syntax in fuel->navigation->render, no problem about the value and the uri etc ..

Thx, have a good day

Comments

  • edited 7:31AM
    When you are on the junior_courses page, set the active value to 'junior_courses'. There is a parameter of 'cascade_selected' you can set to TRUE which will also make the juniors menu item active:
    echo $this->fuel->navigation->render( $params=array( 'var' => 'top_nav', 'active'=>'juniors', 'cascade_selected' => TRUE, ));
  • edited 7:31AM
    that's perfect, and sorry for the answer the default behavior was just fine, my bad
    Thx again for your help, have great day
Sign In or Register to comment.