Posted by david.hunter on 03/07/06 21:35
Hi - my site is bilingual.
I have two language files that look like this :
en.inc
define(HELLO, 'Hello');
fr.inc
define(HELLO, 'Bonjour');
Then my php/html looks like this:
<h3><?php echo HELLO ?></h3>
In each page I check and/or set the language :
index.php :
$lang='en';
require('languages/set_language.php');
set_language.php :
if (isset($_GET['lang'])) {
$lang = $_GET['lang']; }
require("{$lang}.inc");
I have a hyperlink in the footer so that the user can toggle between
languages. The toggle works, but the language parameter is being
APPENDED into the URL and in the address bar of the browser - like this
:
&lang=fr&lang=en&lang=fr&lang=en&lang=fr
Why is this happening and how can I stop it ?
Here is my footer.php code :
<a href="http://website.com/<?php echo
$_SERVER['SCRIPT_NAME'] ?>?<?php echo $_SERVER['QUERY_STRING']
?>&lang=<?php echo $toggle ?>"><?php echo MENU_TOGGLE ?></a>
THANK YOU!
I know it's not practical for people to be going back and forth between
languages - but this problem is still annoying the heck out of me!
[Back to original message]
|