NOTICE: RocketTheme will be releasing templates for Joomla! 1.5 only starting January 2009. Read the thread…
RocketTheme  |  General  |  General Discussion  |  Topic: [Solved] Language dependent menu « previous next »
Pages: [1] Go Down Print
Author Topic: [Solved] Language dependent menu  (Read 1826 times)
Piet Nutbey
Sr. Rocketeer
****
Offline Offline

Posts: 109


WWW
[Solved] Language dependent menu
« on: May 31, 2008, 02:14:17 PM »

Hi all,

I am using JoomFish with RT simplix template. though this question is not RT simplix based, it would be suitable for 99% of RT templates. What I am trying to accomplish is to have dependent menus for separate languages (I.e. Dutch and English).

I found a perfect solution at Joomfish.net for that: http://www.joomfish.net/how-to-.../-how-to-use-language-dependent-menu-items-/-menus.html

Though this is based on having the menus in a true working module position. As far as I know, RT templates (99%) do not make use of module positions for the menus showing, as a part of the index.php from RT Simplix willl show. It makes use of the menuname, not the module position.

Code:
$default_style = "style10"; //[style1... style10]
$layout_style = "B"; // A | B
$enable_rokzoom = "true"; // true | false
$template_width = "950"; // width in px | fluid
$menu_name = "mainmenu"; // mainmenu by default, can be any Joomla menu name
$menu_type = "moomenu"; // moomenu | suckerfish | splitmenu | module
$default_font = "default";      // smaller | default | larger
$show_pathway = "true"; // true | false

The basics of the multi languaged menus is this:

mainmenu_en
mainmenu_nl

You will notice the _language name.

The following I tried to put in the RT template, but that is not working:

Code:
$menu_name = "mainmenu_<?php echo strtolower($mosConfig_lang);?>";

But that is not working.

Does anyone have a clue how I could set the mainmenu_languagename to work through the regular index.php of RT templates.. It should be something similar... but I am not a programmer.

The purpose why is because I want to show some menu items in English, that i do not want to show in the Dutch menu. Normally JoomFish works fine in RT templates for just translating ALL menu items, this is specifically about showing different mainmenus for each language.

Thanks!



« Last Edit: June 02, 2008, 07:03:44 PM by Piet Nutbey » Logged

Best regards,

Piet Nutbey
http://www.joomladsign.com
Nick_
Professional
Jr. Rocketeer
*
Offline Offline

Posts: 29

Re: Language dependent menu
« Reply #1 on: May 31, 2008, 07:10:10 PM »

Unfortunately i do not have an answer to that, but may have a simple suugestion to that. As I understand your users will click on language (flag) thumbnail to get to content in different languages? Right. Why not just copy the whole website, and then load all the items in the other langauge, so when user click on language thumb he will be redirected to the homepage of the other clone site? It could be fast an simple, since anyway you need to create all the other language menu and content items...

I have found some codes in Joomla forum which may give ideas to people who know some more about php and joomla compare to my limited knowledge. Here they are:

<?php if ( $my->id ) { echo '<a href="index.php?option=com_login&Itemid=262">Logout</a>'; } else { echo '<a href="index.php?option=com_login&Itemid=262">Login</a>'; }; ?>

That was used to have a simple link to be replaced based on the login status. I tried to modify it for my purpose, but was not able too, just because I dont know much about php, and where to paste the code like that (tryed index.php file - did nt do any good)

The other code I saw to be used for changing modules loaded to the same position depend on the same login status look like this:

<?php if ( $my->id ) { mosLoadModules ( 'regmenu' );} else { mosLoadModules ( 'guestmenu' ); } ?>

However if you know your php and write something like:

<?php if ( $my->id ) { mosLoadModules ( 'mainmenu_en' );} else { mosLoadModules ( 'maimenu_dt' ); } ?>

and chage login parameters for people using diferent languages it may work? .. maybe?

In anyway.. I thought those codes can give you some ideas Smiley
« Last Edit: May 31, 2008, 07:25:56 PM by Nick_ » Logged
Piet Nutbey
Sr. Rocketeer
****
Offline Offline

Posts: 109


WWW
Re: Language dependent menu
« Reply #2 on: May 31, 2008, 07:21:19 PM »

Hi,

Thank you for the reply.

To have a duplicate website for a few menu items is a bit inconvenient. The JoomFish I use for 2 laguages is perfect.

The php codes you wrote are again based on modules. Joomla RT themes do not use the module positions. They use $menu_name="menuname". I had found those solutions, but they are not useful for RT templates.

Thank you so much for the time you took in replying!


Logged

Best regards,

Piet Nutbey
http://www.joomladsign.com
Muhanad Habbal
Hero Rocketteer
*****
Online Online

Posts: 250


the one in the middle :D

Re: Language dependent menu
« Reply #3 on: June 01, 2008, 10:09:22 AM »

im interested in finding an answer to this question ..
Logged
Piet Nutbey
Sr. Rocketeer
****
Offline Offline

Posts: 109


WWW
Re: Language dependent menu
« Reply #4 on: June 01, 2008, 01:48:37 PM »

im interested in finding an answer to this question ..

I also posted the same question on JoomFish.net so perhaps you might want to keep track of that as well.

http://www.joomfish.net/forum/viewtopic.php?f=9&t=1236&p=5138#p5138


Logged

Best regards,

Piet Nutbey
http://www.joomladsign.com
Piet Nutbey
Sr. Rocketeer
****
Offline Offline

Posts: 109


WWW
Re: Language dependent menu
« Reply #5 on: June 01, 2008, 04:28:26 PM »

Hi all,

Let me try and rephrase the request:

I think what it basically should need for the RT menu is an "if else" statement that should do the following. Since I can't program I do not know how to setup the if else statement other than in real language. Though I hope someone could translate that to proper working code.

It should be something like the following.

Code:
If language is Dutch then the menu is Dutch

Else the menu is English

Hopefully someone is able to translate in real code.



Logged

Best regards,

Piet Nutbey
http://www.joomladsign.com
Piet Nutbey
Sr. Rocketeer
****
Offline Offline

Posts: 109


WWW
Re: [Solved] Language dependent menu
« Reply #6 on: June 02, 2008, 07:04:03 PM »

Hi,

Earlier I wrote this question had to have a very simple answer. Perhaps real programmers have a fair chance that it has become too hard to think simple.

5 minutes ago I decided to scavenge some index.php files to see if i could find a basic if - else statement which I could use to try and program myself.

5 minutes later I got the thing working.

It is so simple and I would like to share this with others that might look for a similar solution.

The original code of a RocketTheme template is as follows:

Code:
$default_style = "style10"; //[style1... style10]
$layout_style = "B"; // A | B
$enable_rokzoom = "true"; // true | false
$template_width = "950"; // width in px | fluid
$menu_name = "mainmenu"; // mainmenu by default, can be any Joomla menu name
$menu_type = "moomenu"; // moomenu | suckerfish | splitmenu | module
$default_font = "default";      // smaller | default | larger
$show_pathway = "true"; // true | false

I got the language dependent menu working by creating 2 extra menus for each language (basically your mainmenu can be dropped, the JoomFish multi language module has no further use and can be uninstalled - no need for that!) and then make the RocketTheme index.php as follows:

Code:
$default_style = "style10"; //[style1... style10]
$layout_style = "B"; // A | B
$enable_rokzoom = "true"; // true | false
$template_width = "950"; // width in px | fluid
$menu_type = "moomenu"; // moomenu | suckerfish | splitmenu | module
$default_font = "default";      // smaller | default | larger
$show_pathway = "true"; // true | false

if( $mosConfig_lang != "english" ) {
$menu_name = "mainmenu_nl";
} else {
$menu_name = "mainmenu_en";
}

Look at the original RocketTheme lines and notice in my lines I also erased the line $menu_name = "mainmenu";

I hope this is helpful for others. It is working on my own (2 languages) website. Mind you! This is not an automated JoomFish solution (but as far as I could tell, neither is the Multi Language JoomFish module - http://www.joomfish.net/how-to-.../-how-to-use-language-dependent-menu-items-/-menus.html ).

I now have a setup where I can show menu-items in RT themes in 1 language which I don't want to show in another language.

Good luck!

With best regards,

Piet Nutbey
The Netherlands
« Last Edit: June 02, 2008, 07:06:44 PM by Piet Nutbey » Logged

Best regards,

Piet Nutbey
http://www.joomladsign.com
Zorro
Professional
Sr. Rocketeer
*
Offline Offline

Posts: 110


Re: [Solved] Language dependent menu
« Reply #7 on: July 16, 2008, 12:11:20 AM »

Piet,

you are a genius. This will probably solve the problem I'm currently facing.

Thanks very much for your solution, I'll give it a go.

Kind regards,
Zorro
Logged
Pages: [1] Go Up Print 
RocketTheme  |  General  |  General Discussion  |  Topic: [Solved] Language dependent menu « previous next »
Jump to: