Revision [15312]

This is an old revision of MultiLanguageMenus made by WigAnt on 2006-09-14 03:44:59.

 

Multi Language Menus

Last edited by WigAnt
Thu, 14 Sep 2006 03:44 UTC [diff]

See also:
 

Note: this text is unfinished. I just started typing it up. -- WigAnt

MultiLanguageMenus is an extension of the menu solution described in WikkaMenus. The extension needs a larger database table for the menus, two new actions and some changes in the wikka.php code. It will also install a cookie for storing the user language. Installation of this extension, requires prior installation of WikkaMenus.


Description and Use


This extension has been designed for three languages, but it can easily be changed into a version for more languages.

Database Table


The database table 'wikka_menus' needs to be extended. Here's the description:

CREATE TABLE `wikka_menus` (
  `name` varchar(20) NOT NULL default '',
  `lng1` char(2) NOT NULL default '',
  `lng2` char(2) NOT NULL default '',
  `lng3` char(2) NOT NULL default '',
  `content` varchar(255) NOT NULL default '',
  `content2` varchar(255) NOT NULL default '',
  `content3` varchar(255) NOT NULL default '',
  `css_class` varchar(20) NOT NULL default '',
UNIQUE KEY `name` (`name`)
) TYPE=MyISAM;


Note that the 'content' is not renamed with respect to WikkaMenus, it ensures that its 'menu' action can still be used to change the menu in the default language.

New Actions


Language switch and redirection

This action installs a cookie in which the language code is stored. This code is typically a two-letter language code, like 'de' or 'en'.

<?php
	if (empty($wikka_vars)) { $wikka_vars="en HomePage"; }
	$pieces = explode(" ", $wikka_vars, 2);
	setcookie("wikkalang", $pieces[0]);
	header("Location: wikka.php?wakka=".$pieces[1]."");
	exit;
?>


Grab the text and save as 'language.php' in your action directory.

Menu editor

multilangmenu


Changes in wikka.php



two functions to deal with the language cookie


Menu Functions

changes in the menufunctions





Notes

To Do


-- WigAnt
There are 2 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki