Problem to create different menus

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
neiya
New Member
New Member
Posts: 3
Joined: Tue Sep 22, 2015 2:05 pm

Problem to create different menus

Post by neiya »

Hello

I have a website with only few pages (8) and I would like to separate my content in two different menus : one with 3 items, the other one with 5 items.

How can I indicate that I want these three pages going to this menu and the other ones going to another menu (using the same template) ?
Moreover the website is multilingual so I can't use the page's alias because it will only work with one language.

My structure is something like that :

1. English
1.1 Home
1.2 ...
1.3 ...
1.4 ...
1.5 ...
1.6 ...
1.7 ...
1.8 ...

2. French
2.1 Home
2.2 ...
2.3 ...
2.4 ...
2.5 ...
2.6 ...
2.7 ...
2.8 ...

And I would like to have
menu 1 : x.1 ; x.2 ; x.3
menu 2 : x.4 ; x.5 ; x.6...

Maybe it could be easier with this structure ? :

1. English
1.1 Infos
1.1.1 ...
1.1.2 ...
1.1.3 ...
1.2 ...
1.3 ...
1.4 ...
1.5 ...

2. French
2.1 Infos
2.1.1 ...
2.1.2 ...
2.1.3 ...
2.2 ...
2.3 ...
2.4 ...
2.5 ...

Sorry for my bad english, just tell me if you don't understand my problem

Mathilde
neiya
New Member
New Member
Posts: 3
Joined: Tue Sep 22, 2015 2:05 pm

Re: Problem to create different menus

Post by neiya »

I succeeded in displaying the first menu with : {menu start_level="3" number_of_levels="3"}
(based on the second structure I put in my post)

But I still can't manage the second one
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Problem to create different menus

Post by velden »

I'm thinking of two menu templates (assuming CMSMS 1.x)

I did not test!

Code: Select all

<ul>
{for $i=0  to 2}
{assign var=node value=$nodelist[$i]}
<li{if $node->current} class="active"{/if}><a href="{$node->url}">{$node->menutext}</a></li>
{/for}
</ul>

Code: Select all

<ul>
{for $i=2  to 7}
{assign var=node value=$nodelist[$i]}
<li{if $node->current} class="active"{/if}><a href="{$node->url}">{$node->menutext}</a></li>
{/for}
</ul>
It results in redundant code of course. It's just one approach of many.
neiya
New Member
New Member
Posts: 3
Joined: Tue Sep 22, 2015 2:05 pm

Re: Problem to create different menus

Post by neiya »

Thank you for your help!

Finally I created two global content blocks for each language (4 in all) in which I put the menu and selected the aliases I wanted with items=" ".
Like that (in case it will help someone else) :
menu_one_en

Code: Select all

{menu items="a, b, c"}
menu_one_fr

Code: Select all

{menu items="a-2, b-2, c-2"}
menu_two_en

Code: Select all

{menu items="d, e, f"}
menu_two_fr

Code: Select all

{menu items="d-2, e-2, f-2"}
After that I call these two global content blocks with $lang_parent to choose the language.

Code: Select all

{global_content name='menu_one_$lang_parent'}
{global_content name='menu_two_$lang_parent'}
It works well but it's not very flexible for the final user.

Thank you once more for your help velden!
Post Reply

Return to “The Lounge”