Old 30th November 2008, 23:08
bernholdt bernholdt is offline
Senior Member
Join Date: Jun 2007
Posts: 156
Thanks: 47
Thanked 13 Times in 11 Posts
Default Language selection

Im working on some language selection in a website, so far it is working wery well exept i cant get it to remember the chosen language when changing pages, im thinking it must be done by either using a session or a cookie but im stuck atm.

Here is my code.
PHP Code:
$languages = array(     
'en' => 'english'
'dk' => 'danish'

if (isset(
$_GET['lang']) AND array_key_exists($_GET['lang'], $languages)) 

'./lang/' $languages[$_GET['lang']] . '.php'



And to change the language im just using simple links
PHP Code:
<a class="link" href="<? echo $_SERVER[PHP_SELF];?>?lang=dk"><?php echo $lng['danish']; ?></a>

<a class="link" href="<? echo $_SERVER[PHP_SELF];?>?lang=en"><?php echo $lng['danish']; ?></a>
Any ideas ??
Reply With Quote
Sponsored Links
Old 1st December 2008, 17:46
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts

Create a session in PHP. This page has a simple example: http://de3.php.net/manual/en/function.session-start.php
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
bernholdt (2nd December 2008)


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Language is not corect fswolf Installation/Configuration 0 30th August 2008 18:59
Squirrelmail – translation to another language Hans Server Operation 5 15th May 2008 18:20
webmail (UebiMiau) different for different language locosoft Installation/Configuration 1 15th September 2007 16:38
language problem panos Installation/Configuration 3 2nd July 2007 14:52
Mailuser language problem wr19026 Installation/Configuration 1 13th August 2006 02:41

All times are GMT +2. The time now is 15:54.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.