Don't like ads? PRO users don't see any ads ;-)
Guest

user agent language selection

By: a guest on Aug 8th, 2012  |  syntax: PHP  |  size: 0.55 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?
  2. $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
  3. switch ($lang){
  4.     case "fr":
  5.         //echo "PAGE FR";
  6.         include("index_fr.php");//include check session FR
  7.         break;
  8.     case "it":
  9.         //echo "PAGE IT";
  10.         include("index_it.php");
  11.         break;
  12.     case "en":
  13.         //echo "PAGE EN";
  14.         include("index_en.php");
  15.         break;        
  16.     default:
  17.         //echo "PAGE EN - Setting Default";
  18.         include("index_en.php");//include EN in all other cases of different lang detection
  19.         break;
  20. }
  21. ?>