WebsiteBaker Community Forum

WebsiteBaker Support (2.10.x) => General Help & Support => Topic started by: johnbroeckaert on January 19, 2018, 10:48:37 AM

Title: 2 menus within one site?
Post by: johnbroeckaert on January 19, 2018, 10:48:37 AM

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
Title: Re: 2 menus within one site?
Post by: Ruud on January 19, 2018, 11:23:27 AM
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.
Title: Re: 2 menus within one site?
Post by: Gast on January 19, 2018, 11:29:29 AM
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
Title: Re: 2 menus within one site?
Post by: johnbroeckaert on January 19, 2018, 12:04:37 PM
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?
Title: Re: 2 menus within one site?
Post by: Gast on January 19, 2018, 12:44:38 PM
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: [Select]
$menu[1] =        'Mainmenu';
$menu[2] =        'Topbarmenu';
$menu[3] =        'Sidebarmenu';
$menu[4] =        'Footermenu';
$menu[5] =        'No Menu';

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: [Select]
<?php echo $headermenu?>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,

be sure, that you select also pages like this in other languages or this menu is empty
Title: Re: 2 menus within one site?
Post by: johnbroeckaert on January 19, 2018, 01:48:50 PM
Thank you Uwe.

Very usefull! and indead very simple.
Thank again
Title: Re: 2 menus within one site?
Post by: Gast on January 24, 2018, 05:35:06 PM
and???

works??   :wink:
Title: Re: 2 menus within one site?
Post by: johnbroeckaert on January 25, 2018, 08:01:00 AM
yeap....

thanks again!

You 're doing a nice job here on the forum!  (Y) (Y)