#1  
Old 30th November 2008, 22:08
bernholdt bernholdt is offline
Senior Member
 
Join Date: Jun 2007
Posts: 154
Thanks: 45
Thanked 13 Times in 11 Posts
Default Language selection

Hi
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:
<?php 
//language
$languages = array(     
    
'en' => 'english'
    
'dk' => 'danish'
    ); 

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

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

else 

    include 
'./lang/english.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 ??
__________________
www.gamebook.me
Reply With Quote
Sponsored Links
  #2  
Old 1st December 2008, 16:46
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
 
Default

Create a session in PHP. This page has a simple example: http://de3.php.net/manual/en/function.session-start.php
__________________
Falko
--
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 (1st December 2008)
Reply

Bookmarks

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 17:59
Squirrelmail – translation to another language Hans Server Operation 5 15th May 2008 17:20
webmail (UebiMiau) different for different language locosoft Installation/Configuration 1 15th September 2007 15:38
language problem panos Installation/Configuration 3 2nd July 2007 13:52
Mailuser language problem wr19026 Installation/Configuration 1 13th August 2006 01:41


All times are GMT +2. The time now is 20:49.


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