WebsiteBaker Support (2.8.x) > Templates, Menus & Design
show_menu2 in WB7 and hidden pages
(1/1)
spida:
Hi there,
I am currently stuck with show_menu2. My client want to expand their website from one language to two languages. OK, no problem so far. But we have a main and a sub navigation in the website. Now, with the second language the structure looks like this:
- DE
-- de page 1
-- de page 2
-- de subcat 1
--- de subcat page 2
--- de subcat page 3
- EN
-- en page 1
-- en page 2
-- en subcat 1
--- en subcat page 2
--- en subcat page 3
The subcategories are hidden pages in order to prevent them from showing up in the main menu. The pages of the subcategories are displayed in a second menu.
* hope this makes sense to you so far *
I used the following code to display the second menu with show_menu2:
--- Code: ---show_menu2(0,38,SM2_ALL,SM2_ALL,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
--- End code ---
(38 is the page-id of de-subcat 1, see structure above please)
Having a second language and needing the same second menu too, I have to discard the page id. I tried quite a number of code according to the Tutorial link removed 404 but wasn't successful. For example, using the following code nothing is shown in the menu although I thought I have to call the second level.
--- Code: ---show_menu2(0,SM2_ROOT+1,SM2_CURR,false,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
--- End code ---
It doesn't work with the third level either:
--- Code: ---show_menu2(0,SM2_ROOT+2,SM2_CURR,false,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
--- End code ---
Your help is very appreciated. Current live version of the website (with just one language still) is here: http://www.kompetenzia-international.com
Cheers
spida
Ruud:
You could try something like this in your template:
--- Code: ---<?php
if (LANGUAGE == 'DE') {
show_menu2(0,38,SM2_ALL,SM2_ALL,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
} elseif (LANGUAGE == 'EN') {
show_menu2(0,xxx,SM2_ALL,SM2_ALL,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
} else {
show_menu2(0,yyy,SM2_ALL,SM2_ALL,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
}
?>
--- End code ---
(use the correct values for xxx and yyy)
This way you can use a different starting point for each language.
Note: You will need to set the correct language in the pages for this to work. (You should anyway)
Admin Edit: fix code design
spida:
Hoi Ruud,
precies! That's it!
Best regards
spida
Navigation
[0] Message Index
Go to full version