WebsiteBaker Support (2.10.x) > General Help & Support

2 menus within one site?

(1/2) > >>

johnbroeckaert:

Is there by chance a description available that explains how to put 2 menus in your template?
and the possibility to choise witch page in witch menu appears?
wb 2.10 - php 7.x

THANKS

Ruud:
The old helppages are more or less still valid.

https://help.WebsiteBaker.org/en/help/designerguide/multiplemenus.php

For the show_menu() calls described in that page you might want to use the good old show_menu2() functions.
The first parameter in show_menu2() is the $menu[] to be used.

Gast:
same menu a second time or a complete different menu?


example for a submenu, that show only childs from the actual page inside of a sidebar

ob_start();
                show_menu2(1, SM2_CURR+1, SM2_CURR+1, '', '<li class="[class]">[a][menu_title]</a></li>', '', '', '', '');
                $childpages = ob_get_contents();
                ob_end_clean();

or you work with menu-groups (only possible inside of a language tree)



ob_start();
        show_menu2(2, SM2_ROOT, SM2_ALL, SM2_ALL, '<li class="[class]"><a href="[url]" class="[class]"><span>[menu_title]</span></a>', "</li>", '<ul>', '</ul>', true, '<ul id="mobile2" class="headernav">');
        $headermenu = ob_get_contents();
        ob_end_clean();

        ob_start();
        show_menu2(1, SM2_CURR, SM2_ALL, SM2_ALL, '<li class="[class] p[page_id]"><a href="[url]" class="[class]"><span>[menu_title]</span></a>', "</li>", '<ul>', '</ul>', true, '<ul id="mobile" class="headernav">');
        $submenu = ob_get_contents();
        ob_end_clean();


maybe, you talk a little about the project, the pagestructure and the planned menu's

johnbroeckaert:
Thank you @Ruud for the "old" helpfiles.! I will into this.

@jacobi22
It is a bit difficult to tell about the project but I'll try.

it becomes a site for three languages and the intention is to have a number of pages fixed in a menu and the rest in a different menu. For example at the top of the page the pages: home - about us - contact
and under the header image the pages that are about the products / services that are delivered. (no webshop!)
Is this a bit clear?

Gast:
not so difficult to unterstand  ;-)

if you dont have it yet, you need a definition of multiple menus in your frontend-template info.php, the menu-groups....
examplecode:

--- Code: ---$menu[1] =        'Mainmenu';
$menu[2] =        'Topbarmenu';
$menu[3] =        'Sidebarmenu';
$menu[4] =        'Footermenu';
$menu[5] =        'No Menu';
--- End code ---

choose your own module-group-names. if you need more groups, build more groups, no limits ;-)

after every changing in info.php, you have to reload the templates in WB (Addons -> Advanced)

After that, go to the page Settings from every needed page and set there the menu group
remember: every page without a special menugroup are automatically in menu group 1, so before you start to change anything, all pages are in menu-group1

now change the menu-group for the pages in the top menu
for example: home - about us - contact

Use my second code example. these are the topmenu ($headermenu) and the mainmenu ($submenu)

Output of the menu with

--- Code: ---<?php echo $headermenu; ?>
--- End code ---
where ever you need

in my code example, i use the menu-group-id == 2 for the top- or headermenu, use this ID in the menu-call

--- Quote ---show_menu2(2, SM2_ROOT,
--- End quote ---

be sure, that you select also pages like this in other languages or this menu is empty

Navigation

[0] Message Index

[#] Next page

Go to full version