Make a submenu in a submenu

edited February 2012 in Modules
HI I have a menu system made using the nav.php in _variables folder. I have a need if possible to make a submenu item break out into 3 subitems and have the parent not go anywhere.

So, something like this.
//other menu $nav['other'] = 'Other'; //other subMenu $nav['other/item1'] = array('label' => 'item1', 'parent_id' => 'other'); $nav['other/item2'] = array('label' => 'item2', 'parent_id' => 'other'); $nav['other/item3'] = array('label' => 'item3', 'parent_id' => 'other', location => ''); // click should go nowhere // item3 submenu $nav['item3/sub1'] = array('label' => 'sub1', 'parent_id' => 'item3'); $nav['item3/sub2'] = array('label' => 'sub2', 'parent_id' => 'item3'); $nav['item3/sub3'] = array('label' => 'sub3', 'parent_id' => 'item3');

it should look like this if print array or generally.
other menu-> item1-> item2-> item3-> sub1-> sub2-> sub3->
Much appreciation.

Comments

  • edited 1:30AM
    If you set the a location parameter in the array to FALSE, it will render the menu item without a link. So for the first menu item you could do:
    $nav['other'] = array('location' => FALSE, 'label' => 'Other', 'parent_id' => NULL);
  • edited 1:30AM
    Great, ok. Can I make the item3 null also?

    Is there any way to get the submenu of item3 to shoot out to the right I listed?
  • edited 1:30AM
    You can set FALSE, to any location value in the nav if you don't want it to link anywhere. With regards to having the menu shoot out to the right, I'm assuming you need some sort of way to style your menu and are looking for different ways to do that? If so there are a few parameters you can assign to help with assigning classes, IDs and styles to menu items:
    http://www.getfuelcms.com/user_guide/libraries/menu
  • edited 1:30AM
    ok thanks. I am not really looking to add style as am using the default dropdown meny, I am just trying to make another submenu below a submenu item like the tree I have above. It would be a great option to be able to nest more submenus.
  • edited 1:30AM
    You can make your menus go as deep as you need... in your case you would just specify the parent_id of "other/item3".
  • edited 1:30AM
    oh wow ok. I thought I tried that. if I set the parent_id of item3/sub1 to 'other', that would give the sub1 to kick out into another submenu?
  • edited 1:30AM
    It should. The parent_id needs to reference the menu items array key. By default, if no location parameter is set, then it will use the key value as the location, however it serves a duel purpose in that it also indicates the unique identifier of the menu item that parent_id needs to reference.
  • edited 1:30AM
    If I do this

    $nav['other/item3'] = array('label' => 'item3', 'parent_id' => 'other', location => ''); or $nav['other/item3'] = array('label' => 'item3', 'parent_id' => 'other', location => FALSE);
    The link is just text, it does not have any styling.

    if I set this:
    // item3 submenu $nav['item3/sub1'] = array('label' => 'sub1', 'parent_id' => 'other');
    it just stays as a submenu of OTHER not of ITEM3. How do I get item3 to breakout into another dropdown menu after rolling over ITEM3? If I do this as i quoted above:
    // item3 submenu $nav['item3/sub1'] = array('label' => 'sub1', 'parent_id' => 'item3');
    it ITEM3 stays as a submenu of OTHER. I can't seem to make sub1 of item3 to see item3 as its parent. Mainly curious if it is possible to nest and I can't get it to do that.
  • edited 1:30AM
    To match the structure you need above, try this:
    //other menu $nav['other'] = 'Other'; //other subMenu $nav['other/item1'] = array('label' => 'item1', 'parent_id' => 'other'); $nav['other/item2'] = array('label' => 'item2', 'parent_id' => 'other'); $nav['other/item3'] = array('label' => 'item3', 'parent_id' => 'other', location => ''); // click should go nowhere // item3 submenu $nav['other/item3/sub1'] = array('label' => 'sub1', 'parent_id' => 'other/item3'); $nav['other/item3/sub2'] = array('label' => 'sub2', 'parent_id' => 'other/item3'); $nav['other/item3/sub3'] = array('label' => 'sub3', 'parent_id' => 'other/item3');
  • edited 1:30AM
    ok, I will do that. I thought i tried that and the "/" would mess it up. I will give it a go.
  • edited 1:30AM
    ok, well I think I am doing this a bit different and maybe why it is not working. I was using this structure to explain it but I think the key is messing it up. I can't say for sure, but i tried what you have and it gives the other/item3 link as no css and no rollover on it. I tried everything I could and it does not work. The keys I used also ar not the same module. The other parent button is only for reference, it is not really a class. "Other" is a catch all for different classes so I guess using the location parameter should direct some of these items but that set to FALSE or '' shows no CSS on that menu item. Overall, it is not working. I can't make this nest down with what I am trying to do.
  • edited 1:30AM
    Just to be clear, the Menu class only creates the HTML structure for you and by default uses nested ul and lis to do this. To create the rollover effects, you'll need to implement your own CSS.
  • edited 1:30AM
    Makes sense, I would have to do some more work to get that. For now I am working around it. Good exercise though for the future even though I did not accomplish much.
Sign In or Register to comment.