WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: spida on March 08, 2010, 04:58:49 PM

Title: show_menu2 in WB7 and hidden pages
Post by: spida on March 08, 2010, 04:58:49 PM
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: [Select]
show_menu2(0,38,SM2_ALL,SM2_ALL,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');(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: [Select]
show_menu2(0,SM2_ROOT+1,SM2_CURR,false,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');It doesn't work with the third level either:
Code: [Select]
show_menu2(0,SM2_ROOT+2,SM2_CURR,false,'[li]<a href="[url]" title="[menu_title]">[menu_title]</a>');
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


Title: Re: show_menu2 in WB7 and hidden pages
Post by: Ruud on March 10, 2010, 10:39:09 AM
You could try something like this in your template:

Code: [Select]
<?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>');
}
?>

(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
Title: Re: show_menu2 in WB7 and hidden pages
Post by: spida on March 11, 2010, 11:13:03 PM
Hoi Ruud,

precies! That's it!

Best regards
spida