note 9674 deleted from function.setcookie by john
| From: | john@php.net | Date: | Sat, 30 Nov 2002 16:12:53 +0000 |
| Subject: | note 9674 deleted from function.setcookie by john | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40150@lists.php.net to get a copy of this message | ||
To choose multi language on a Site based on Cookie. Put a image flag that links to the
index.php?lang=uk or index.php?lang=pt.
In index.php you put
<?
if (($lang) and ($lang != $active_lang)) {
SetCookie("active_lang", "", "", "");
SetCookie("active_lang",$lang,time()+31536000,"");
header("location:index.php");
} elseif ($active_lang == '') {
SetCookie("active_lang","uk",time()+31536000,"");
}
?>
To choose diferent file for depending for language put in index.php (Dynamic sections)
<? include ("../templates/main_menu_"."$active_lang"); ?>
This way you set an Active language on a Cookie. Every time that person visits your site it will be
displayed in his/her pref. language.
Have fun with this multi language simple script.
Joao Correia
joao.correia@hamala.pt