1 (edited by sammik2 2013-01-19 08:17:14)

Topic: Multilevel menu

First, thank you for very nice CMS.
I would like to know, how is possible to create multilevel menu.
I found topic, that it is not possible yet http://forum.monstra.org/topic/27/menu-drop-down/
but in monstrathemes.com it is done, so how it is at the moment?
Thank you.
(I am very new to monstra and php)

Re: Multilevel menu

DOWNLOAD (.zip)
This is not finally complite version of plugin as autor said from russian forum =DD

(с) Roman Art
So far So good wink

RomanArt's Website

Re: Multilevel menu

Thank you, I will look on it. I see. I finnally have to learn azbuka.

Re: Multilevel menu

i made some small mods, to show a bootstrap dd-menu ...
http://antiben.an.funpic.de/pictures/monstra_bootdd.png

tested against monstra 2.1.3, only one level is possible...

ddmenu-plugin.zip (11K)

5 (edited by glebcha 2013-02-26 11:50:16)

Re: Multilevel menu

antiben, is it possible to leave only parent with class='active', but not children? Now only children highlighted and not parent.

What I need is:



<

>
                                                                                                 |
                                                                                                \|/
                                                                            Child (without css highlight)

I guess I should edit this part:

            // get the default category
            if (trim($item['branch']) !== '') {
                if (trim($li_active) !== '') {
                    $li_active = ' class="active dropdown"';
                } else {
                    $li_active = ' class="dropdown"';
                }
                if (trim($anchor_active) !== '') {
                    $anchor_active = ' class="current dropdown-toggle" data-toggle="dropdown" ';
                } else {
                    $anchor_active = ' class="dropdown-toggle" data-toggle="dropdown" ';
                }
            }
            if (trim($item['branch']) !== '') {
               echo '
  • '.''.$item['name'].''; echo '
  • '; } else { echo '
  • '.''.$item['name'].''.'
  • '; }

    6 (edited by antiben 2013-02-26 17:19:21)

    Re: Multilevel menu

    mh, not quite sure what you mean...

    Now only children highlighted and not parent.

    a parent gets also active, see example below (reload the screenshot, now it's with a mouse pointer):

    pages: name(slug)
    -   pagetitle1(pageone)
     →  pagetitle2(pageone/pagetwo)
     →  pagetitle3(pageone/pagethree)
    default menu: name(link,branch)
    pagetitle1(pageone,menutest)
    menutest menu: name(link,branch has to be empty - since only one level ...)
    pagetitle1(pageone,)
    pagetitle2(pageone/pagetwo,)
    pagetitle3(pageone/pagethree,)


    is it possible to leave only parent with class='active', but not children?

    if you want to have only the parent active, try this mod (it's the part above the code you posted):

                $item['descripton'] = Html::toText($item['description']);
                $pos = strpos($item['link'], 'http://');
                if ($pos === false) {
                    $link = Option::get('siteurl').$item['link'];
                } else {
                    $link = $item['link'];
                }
                if (isset($uri[0]) && $uri[0] !== '')  {
                    if (in_array($item['link'], $uri) && trim($item['branch']) !== '') {
                        $anchor_active = ' class="current" ';
                        $li_active = ' class="active"';
                    } 
                } else {
                    if ($defpage == trim($item['link'])) {
                        $anchor_active = ' class="current" ';
                        $li_active = ' class="active"';
                    }
                }
                if (trim($item['target']) !== '') {
                    $target = ' target="'.$item['target'].'" ';
                }
                // get the default category

    7 (edited by antiben 2013-02-27 02:48:47)

    Re: Multilevel menu

    another confusing way could be:
    pages: name(slug)[¹]

    - maintitle1(mainpageone)
     →  pagetitle1(mainpage/pageone)
     →  pagetitle2(mainpage/pagetwo)
    - maintitle2(mainpagetwo)
     →  pagetitle1(mainpagetwo/pageone)
     →  pagetitle2(mainpagetwo/pagetwo)
    - maintitle3(mainpagethree)
     →  pagetitle1(mainpagethree/pageone)
     →  pagetitle2(mainpagethree/pagetwo)

    default menu: name(link,branch)

    menutitle1(,ddmenutest)

    ddmenutest menu: name(link,branch has to be empty - since one level only ...)

    ddmenutitle1(mainpageone,)
    ddmenutitle2(mainpagetwo,)
    ddmenutitle3(mainpagethree,)

    [¹] pseudo-pages - not possible at the time, see here

    image with submenu:
    http://antiben.an.funpic.de/pictures/monstra_bootddv2.png
    download: ddmenu-2-plugin.zip (17K)
    note: only tested against a default monstra 2.1.3 installation...

    8 (edited by glebcha 2013-02-27 05:15:03)

    Re: Multilevel menu

    Your mod just disabled class active for all

  • elements smile

    What I need is:

  • Child1
  • Child2