So...
I need to make a language switch thingy...
This is how I need to do it:
I got 2 images...
When someone clicks the image, I set a cookie that remembers the lang, and the lang tells the server what directory to use...
I got 2 dirs, one called is and one called eng, and the cookies control what directory to use...
My problem is...
I've got to be able to control the image by the cookie...
Here's what I got so far...
<?php
if ($lang == '1' || $lang == '0') {
if ($lang == '1') {
setcookie("language", "1", time()+2419200); //29030400
Header("Location: eng/");
}
if ($lang == '0') {
setcookie("language", "0", time()+2419200); //29030400
Header("Location: is/");
}
}
?>
And all the HTML stuff here
<?php
$flag_il = ' <a href="?lang=0" onFocus="this.blur()"><img src="img/flag_ice.gif" width="28" height="20" border="0"></a>';
$flag_gb = ' <a href="?lang=1" onFocus="this.blur()"><img src="img/flag_gb.gif" width="41" height="20" border="0"></a>';
// $bla = 1 - $bla = 0 - Default: 0
echo $language ? $flag_gb : $flag_il;
?>
So...
If you can think of a better way to do this..
please o please do tell me 🙂
I know this isn't THE best way... but what the heck... All suggestions appreciated...
Thanks in advance, Arni