Page 1 of 1

Submenu levels to always show > 1

Posted: Thu Mar 01, 2007 11:55 pm
by meanpenguin
Using the Simple Menu template, all is good except I need one more feature

The ability to always show 2 levels of the menu on the right side bar.

Using

{menu template='simple_navigation.tpl' start_level='2' number_of_levels='3 collapse="0" }

Shows two levels of menus but clicking on any of the menus will not expand the children.

I need something like min_levels_to_show option.

Thank You,
Edward

Re: Submenu levels to always show > 1

Posted: Fri Mar 02, 2007 5:41 am
by cyberman
Hmm, dont know if I'm understand right ... but if you want something to expand think collapse must be 1  ::).

Re: Submenu levels to always show > 1

Posted: Fri Mar 02, 2007 6:16 pm
by meanpenguin
Currently the menus on the left side show 1 level of menus

Topic1
Topic2
Topic3


I would like it to show two levels

Topic1
  Sub topic 1A
  Sub topic 1B
  Sub topic 1C
Topic 2
  Sub topic 2A
Topic 3
  Sub topic 3A
  Sub topic 3B
  Sub topic 3C
  Sub topic 3D


Clicking on Sub topic 1B would make the menus under 1B to expand

Topic1
  Sub topic 1A
  Sub topic 1B
      1B Item 1
      1B Item 2
      1B Item 3
  Sub topic 1C
Topic 2
  Sub topic 2A
Topic 3
  Sub topic 3A
  Sub topic 3B
  Sub topic 3C
  Sub topic 3D


Thanks,
Edward

Re: Submenu levels to always show > 1

Posted: Fri Mar 02, 2007 7:11 pm
by chead
Take a look at the custom menu templates called menu_icon_expand and section_expand in the wiki; I think they're close to what you're looking for.

User_Handbook/Admin_Panel/Layout/Menu_Manager

Re: Submenu levels to always show > 1

Posted: Sat Mar 03, 2007 7:47 am
by meanpenguin
Can someone add this into the code base...for the MenuModule to support minimum levels of menu items to show.

In file action.default.php

Replaced
if (isset($params['number_of_levels']) && $params['number_of_levels'] == '1')
    $getchildren = false;


with
if (isset($params['number_of_levels']) && $params['number_of_levels'] == '1'
    && isset($params['min_levels']) && $params['min_levels'] == '1')
    $getchildren = false;



In file MenuManager.module.php

Added last 1 line
    function SetParameters()
    {
        $this->CreateParameter('collapse', '1', $this->lang('help_collapse'));
        $this->CreateParameter('items', 'contact,home', $this->lang('help_items'));
        $this->CreateParameter('number_of_levels', '1', $this->lang('help_number_of_levels'));
        $this->CreateParameter('min_levels', '1', $this->lang('help_min_levels'));


Added last 4 lines
if (!(isset($params['number_of_levels']) && $newnode->depth > ($params['number_of_levels']) - ($origdepth)) && (count($showparents) == 0 || (count($showparents) > 0 && in_array($content->Hierarchy() . '.', $showparents))))
{
    $this->GetChildNodes($onechild, $nodelist, $gCms, $prevdepth, $count, $params, $origdepth, $showparents);
}
elseif ((isset($params['min_levels']) && $newnode->depth GetChildNodes($onechild, $nodelist, $gCms, $prevdepth, $count, $params, $origdepth, $showparents);
}