multi language / menu

Multi language / menu, a forum discussion on Jojo CMS. Join us for more discussions on Multi language / menu on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
Rosaline Rosaline

28 Mar 2008
Posts: 8

Hey there all!

I've been out a while but I'm back. And wondering about "multi language".

I am wanting to set up a web page which is accessible as well in Portuguese and English, and then a main menu and sub menu.
Would it be best to make in fact the main menu the languages, en then first sub / second sub?
(If that would be the case how would I show the second sub menu... (yes i tried to figure out how you did the first 2 :) )

Then I wondered if it is possible to make a link in the menu that doesn't go to an inside page, but to an external page. I noticed that the only links like that are embedded in the html code, but not in the cms.

Thnx :)
Still loving JoJo!



31 Mar 2008
Posts: 379

This asumes you're running off a current version of Jojo - I can't remember how far back in the releases we enabled this stuff :)

For the Multilanguage menu we normally use a dropdown menu for users to choose their language from the default language homepage, each language has it's own home page and navigation menu with as many levels as you like :

Turn on multilanguage,

make content-less Language pages (eg English, Portuguese) at root level as language roots, and add child Home pages for each of them,

Use Manage Site Languages (in Customize) to pick the Root and Home pages for each language and "enable" the languages you want to be live on the site.

Then set up some code in the global.php and template.tpl files of your theme to handle the language display in the menus:

/* Create current section/ current sub pages array to show cascading selected menu levels beyond child*/
$selectedPages = _getSelected($page->id);
$smarty->assign('selectedpages', $selectedPages);

/* Create navigation array */
$root = 0;
if (_MULTILANGUAGE && isset($page)) {
/* If on a multilanuage site, get the root for the current language */
$mldata = JOJO::getMultiLanguageData();
$root = $mldata['roots'][$page->getValue('pg_language')];
$smarty->assign('home', $mldata['homes'][$page->getValue('pg_language')]);
$smarty->assign('root', $root);
/* assign navigation: _getGHNav() = ("home page", "# Levels of sub nav") */
$smarty->assign('nav', _getNav($root, 3));
$smarty->assign('footernav', _getNav($root, 0, 'footernav'));

if (isset($selectedPages[2])) {
$smarty->assign('subnavparent', $selectedPages[1]);
$smarty->assign('subnav', _getNav($selectedPages[1], 0));
$subsubnav = _getNav($selectedPages[2], 0);
$smarty->assign('subsubnav', (boolean)count($subsubnav));
} else {
/* Get children pages of this page */
$smarty->assign('subnavparent', $page->id);
$smarty->assign('subnav', _getNav($page->id, 0));
/* Languages for dropdown */
$languagelist = JOJO::selectquery("SELECT * FROM {language} WHERE active='yes'");
$smarty->assign('languagelist', $languagelist);

and then in the template (for the dropdown)....

<div id='languagebox'>
<label for="language">Choose site language </label><select id='language' name='language' onchange='document.location.href = this.value;'>
{foreach from=$languagelist item=l}
<option value='{$SITEURL}/{$l.longcode}/'{if $l.languageid == $pg_language} selected='selected'{/if}>{$}</option>

Clear as mud?? :p



31 Mar 2008
Posts: 379

example implementation at
Rosaline Rosaline

2 Apr 2008
Posts: 8

Hi Tom!

I believe I read something on the jojo website about multilangual functionality... But I couldn't find it anymore when I looked for it again. But: I have the latest jojo release :)

Thanks for your help!!! It's almost working.... hehehe

To start with, I changed a line in your query to this:
/* Languages for dropdown */
$languagelist = JOJO::selectquery("SELECT * FROM language WHERE active='yes'");
Otherwise huge errors :)

Then I set in customize options config multilanguage on.

But as soon as I click a language in that list, it immediately gives a 404 page :( so I guess that part hasn't really been developed yet (as understandable hehe).
But what should I do now? *help* :-) maybe I can tell him manual in the database?

Very nice example btw! I already almost booked my fli ght to go study English in New Zealand! :D *jeej*




2 Apr 2008
Posts: 379

If there's not an admin interface for languages in Admin > Customize > Manage Languages, you will have to set the language root and home pages manually in the database. Have a look in Edit Pages to find the page id numbers for each of them and put those in the database.

e.g. English root page = id 34, English Home page = id 35.

The fact that the languagelist query is producing errors with the curly brackets around the table name suggests to me that you're running one of the alpha releases rather than the current beta release?

We should have a new release coming out soon in any case which will have more comprehensive multi-language support, and we've also been working on upgrading the plugins so that they work properly across multi-language sites too - Search and Tags both work now, Articles is the next one I want to look at.

Rosaline Rosaline

3 Apr 2008
Posts: 8


And... not working lol... :(

Okay i got an error, so i started doing it step by step (took to test Spanish instead of Portuguese :) so dont think "huh") :--)

I did all the things like you say but it's not working. I found out that when I tried to change "home" of English in the database, the whole website didn't work anymore, I get an error page that the site cannot be loaded.

I don't know if my previous finding has to do with these things but:
when I go to the page i see in the menu the pages that I put in my "English" root, so home (and others if i put there).
When I select spanish in the dropdown, I get to the spanish home page, but I still see in the menu at the place the link to the english home page etc. and nothing else.
In the subpage menu I see the pages in my Spanish folder.
The breadcrums do show "Spanish > Home Spanish" but the link under spanish is
<a href="english/espanol/" title="Spanish">Spanish</a>
while the link in the dropdown doesn't include that first english..

(does it matter if in the main language folders I put a "page url"?)

So... to see what was happening I add another language, German, that was to see if maybe that one would appear as well in the submenu under the spanish home..., but no, it works the same for that language...

I also tried to not make English an active language, but still I see the content of my english folder in the mainmenu....


and thnx so much already for all your explanations!



3 Apr 2008
Posts: 379

a bit forward of me.. but could you set up an admin user and email me the login details for the site to tom at, and I'll take i look at it - just too many variables to account for remotely :p

then i can post the results back here for others should they be interested :)

Multi-language support in Jojo is pretty good, and getting better, but is not really at the totally intuitive stage yet
Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply

You need to Register or Log In before posting on these forums.