WebsiteBaker Community Forum

WebsiteBaker Support (2.10.x) => General Help & Support => Topic started by: johnbroeckaert on February 18, 2018, 08:31:01 AM

Title: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 18, 2018, 08:31:01 AM
I would like advice on the design of a website where the difficulty lies in the fact that there are different services are offered that each should have their own menu and that also in three languages.

The start page on which the service should be chosen is not a problem, but the underlying pages are the challenge.

The structure of the website should therefore look something like this:

Main page: menu structure: Service 1 Service 2 Service3 Service4 (in three languages)
If Service 1 is chosen then only menu structure for service 1

Service 1 ----- menu item1 EN ----- menu item1 FR ---- mnuitem1 EN
                ----- menu item2 EN ----- menu item2 FR ---- mnuitem2 AND
                ----- menu item3 EN ----- menu item1 FR ---- mnuitem3 AND
                etc.
If Service 2 is selected, then only menu structure for service 2
Service 2 ----- menu item1 EN ----- menu item1 FR ---- mnuitem1 EN
                ----- menu item2 EN ----- menu item2 FR ---- mnuitem2 AND
                ----- menu item3 EN ----- menu item1 FR ---- mnuitem3 AND
                etc.
If Service 3 is chosen, then only menu structure for service 3
Service 3 ----- menu item1 EN ----- menu item1 FR ---- mnuitem1 EN
                ----- menu item2 EN ----- menu item2 FR ---- mnuitem2 AND
                ----- menu item3 EN ----- menu item1 FR ---- mnuitem3 AND
                etc.
If you choose Service 4, then only menu structure for service 4
Service 4 ----- menu item1 EN ----- menu item1 FR ---- mnuitem1 EN
                ----- menu item2 EN ----- menu item2 FR ---- mnuitem2 AND
                ----- menu item3 EN ----- menu item1 FR ---- mnuitem3 AND
                etc.

The languages ​​are of course dependent on the chosen language.
I thought I would solve that with the Multilingual module

How do I only view the menus of the chosen service? For example, is it an idea to modify the template for the services and adjust the show menu 2 module with root + 1?

Thanks for contributing ideas!
Title: Re: Menu for independent services and 3 languages
Post by: Gast on February 18, 2018, 04:07:26 PM
very interesting and ( i think) very tricky

it's not possible, to mix languages inside of a tree, if you use show_menu2

some questions....
Quote
Main page: menu structure: Service 1 Service 2 Service3 Service4 (in three languages)

do you have for every link content in the selected language like

-- EN
---- Service1 (en)
---- Service2 (en)
-- FR
---- Service1 (fr)
---- Service2 (fr)
etc

or is it like this?
-- Service1 (en)
-- Service2 (fr)
etc

#2: if you click on one of the "Service"-Links, you have a submenu(?) like this
Quote
Service 1 ----- menu item1 EN ----- menu item1 FR ---- mnuitem1 EN
                ----- menu item2 EN ----- menu item2 FR ---- mnuitem2 AND
                ----- menu item3 EN ----- menu item1 FR ---- mnuitem3 AND
                etc.

and an complete different menu behind "Service2"?

and these elements are all in different languages?

if you use show_menu2, you have the language-problem with all childs inside of a tree-part.

i think, the best solution is a own menu without show-menu2,

#1 - possible with some sql-request's (works only, if you stay everywhere inside of a tree-part)

#2 - a hard-coded menu in a extra file, included in your template-index.php, use there the [wblink] as href-attribute (my favorite)

P.S.: it's of course possible, to have a page with a different content language inside of another language tree, for example

Service 1 (en) - content in english
-- menu item1 EN (PageLanguage = en) - content in english
-- menu item1 FR (PageLanguage = en) - content in french (if needed)

Service 1 (fr) - content in french
-- menu item1 EN (PageLanguage = fr) - content in french
-- menu item1 FR (PageLanguage = fr) - content in english (if needed)
etc

important in every case is the page language from the main- and the subpages in every single tree

Title: Re: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 18, 2018, 06:25:50 PM
@jacobi22

I will try to give you the structure of the menu.


Mainmenu NL: Winkel  –  Restaurant – Taarten – Kamers
               EN:  Store  –  Restaurant –  Cakes  –  Rooms
          FR: Epicerie –  Restaurant – Gateaux – Chambres


NL Winkelmenu:     Welkom – assortiment – bestellen – Aanbiedingen – etc 
EN Store menu:     Welcome - assortment – ordering  -  offers          -  etc
FR Epicerie menu:   Bienvenue-assortiment-commande - offres          -  etc

likewise for Restaurant , Cakes and Rooms. (other names but for al the language the same (sub)menu items.)
So the sub pages of the four main-items are per item the same. like this

Service 1 (en) - content in english
-- menu item1 EN (PageLanguage = en) - content in english
-- menu item2 EN (PageLanguage = en) - content in english
etc.

Service 1 (fr) - content in french
-- menu item1 FR (PageLanguage = fr) - content in french
-- menu item1 FR (PageLanguage = fr) - content in french
etc.

on the home page you choose a language and the menu is then presented in that language. (4 services - works already) Then select one of the 4 services and the corresponding menu is presented in the chosen language. The main menu with the various services may no longer be displayed. Only the submenu items of the chosen main menu. So if you choose "store" in the main menu, only the sub-items from the store can be added on the next page and nothing else. (Welcome - assortment – ordering  -  offers          -  etc)

Like you sad: Interesting and tricky

===========================================================
Ich werde versuchen, Ihnen die Struktur des Menüs zu geben.


Hauptmenü NL: Winkel - Restaurant - Taarten - Kamers
                 EN:  Store  –  Restaurant –  Cakes  –  Rooms
                 FR: Epicerie - Restaurant - Torten - Chambres


NL Winkelmenü: Welkom - Sortiment - bestellen - Aanbiedingen - etc
EN Store menu: Welcome - assortment – ordering  -  offers          -  etc
FR Epicerie Menü: Bienvenue-assortiment-commande-offres-etc

ebenso für Restaurant, Kuchen und Zimmer. (andere Namen, aber für alle Sprachen die gleichen (Unter-) Menüpunkte.)
Die Unterseiten der vier Hauptelemente sind also pro Element gleich. so was

Service 1 (en) - Inhalt in Englisch
- Menüpunkt 1 EN (PageLanguage = en) - Inhalt in Englisch
- menupunkt 2 EN (PageLanguage = en) - Inhalt in Englisch
etc.

Service 1 (fr) - Inhalt auf Französisch
- Menüpunkt 1 FR (PageLanguage = fr) - Inhalt auf Französisch
- Menüpunkt 1 FR (PageLanguage = fr) - Inhalt auf Französisch
etc.

Auf der Startseite wählen Sie eine Sprache und das Menü wird dann in dieser Sprache angezeigt. (4 Dienste - funktioniert bereits) Wählen Sie dann einen der 4 Dienste in das entsprechende Menü wird in der gewählten Sprache angezeigt. Das Hauptmenü mit den verschiedenen Diensten wird nicht mehr angezeigt. Nur die Untermenüpunkte des gewählten Hauptmenüs. Wenn Sie also im Hauptmenü "Laden" wählen, können nur die Unterelemente aus dem Geschäft auf der nächsten Seite hinzugefügt werden und sonst nichts. (Willkommen - Sortiment - Bestellung - Angebote - etc)

Wie du sagt: Interessant und knifflig
Title: Re: Menu for independent services and 3 languages
Post by: Gast on February 19, 2018, 06:24:44 PM
Not as hard as I thought at the beginning....if i understand everything correct  :oops: :oops:

Step 1:  build 3 pages  with type menu-link for the flag-menu, called like the used language in upper letters like EN, FR, NL

Step 2: now, the target from the next pages are important. if you have content for every single page (for example in Epicerie) , use the needed module type on every page, if you need a redirect to the next child, use menu-link as module-type
now build the four pages like Epicerie –  Restaurant – Gateaux – Chambres for every language

it's recommended, to build at first the complete tree for the main language in this project (your language-setting in wb-options), this makes a better handling for the pages languages in every page setting (inherited from the parent page) and also for the page-code-settings in all other pages

be sure, that you use everytime the correct language in this tree-part!!

to the menu

for the flag-menu, take a look into the WB-DefaultTemplate (best solution in WB 2.11 RC-Versions - the stable Version come's tomorrow)

the four main pages like Epicerie –  Restaurant – Gateaux – Chambres

ShowMenu2 like
Code: [Select]
<div class="topmenu">
            <?php
                
echo show_menu2(1SM2_ROOT+1SM2_STARTSM2_TRIM|SM2_PRETTY,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');
            
?>

        </div>

P.S.: it's a very simple call and needs css. this menu show's only the Level1- pages

the submenu
Code: [Select]
<div class="menu">
            <?php
                
echo show_menu2(1SM2_ROOT+2SM2_ALLSM2_ALL|SM2_PRETTY,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');
            
?>

            </div>

P.S.: dont forget to set the target for the 3 Main-Pages EN, FR, NL
this menu show's all other subpages on a different place

picture with some example pages
(https://i.gyazo.com/56ccb50577577d6a714bc8e17c5fdeba.png)
Title: Re: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 19, 2018, 07:02:38 PM
Thank You @jacobi22!

I will try this tommorow and post some feedback overhere.
One question. Don't I need the laguage module?

Have a nice evening!
Title: Re: Menu for independent services and 3 languages
Post by: Gast on February 20, 2018, 11:38:10 AM
Quote
One question. Don't I need the laguage module?

the language Module brings the (automitic) Flag menu and builds the re-direct to the favorite page in other languages. So i think, it's the best solution, to work with it.

P.S. the MultiLingual-Module (or today WBLingual) is included in WB 2.11, no further action needed
Title: Re: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 20, 2018, 12:49:17 PM
Uwe,
Is there a difference between wb 2.11.0 RC and the final release that is coming today?
Thanks
Title: Re: Menu for independent services and 3 languages
Post by: Gast on February 20, 2018, 01:01:42 PM
Quote
Is there a difference between wb 2.11.0 RC and the final release that is coming today?

a lot of differents between RC 1 and RC2 and only some small differents between RC2 and the coming stable version, but no problem then, only overwriting your RC-Version with the coming stable to replace the changed files. there are no function- or databease changes , only some code corrections
Title: Re: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 20, 2018, 04:29:31 PM
I have tried the menu as you indicated in your previous post and the first menu is fine, but on the second menu I get the submenu items of all services. (It's a horizontal menu)

For example for the menu: STORE
The menu displays:
Welcome - Assortment - Ordering

o Cakes 1
o Cakes 2

o these are from the Cake subdirectory (only tried with two items STORE / CAKES)
I used this line for the second menu:

Code: [Select]
<?php   echo show_menu2(1SM2_ROOT+2SM2_ALLSM2_ALL|SM2_PRETTY,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');  ?>
It seems the menu is displaying ALL menu's form Root+2
I have correctly defined the language and the parents menu items as in your example.

any idea?

Thanks!
Title: Re: Menu for independent services and 3 languages
Post by: Gast on February 20, 2018, 05:17:33 PM
take a look in the readme   :wink:
i think, SM2_TRIM is the secret there. it disabled the display of all other pages

Quote
<?php   echo show_menu2(1, SM2_ROOT+2, SM2_ALL, SM2_TRIM|SM2_PRETTY,'<li><span class="menu-default">[ac][menu_title]</a></span>','</li>','<ul>','</ul>');  ?>

if you have more trouble, please send me a mysql-backup from your pages-table to my mailadress
Title: Re: Menu for independent services and 3 languages
Post by: johnbroeckaert on February 21, 2018, 09:20:16 AM
Works perfectly like that. Thank you
 (Y) (Y)