|
Posted by Koncept on 10/24/06 05:57
In article <453D3915.5020306@asjflasjk.com>, MSB <asldfh@asjflasjk.com>
wrote:
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> > <title>Sporg fordeling</title>
> > </head>
> > <body>
> > <?php
> > $userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
> > $userlang=substr($userlang,0,2);
> > switch($userlang) {
> > // Work so far, but the don't work.
> > case 'en': ("location: /en/index.php");break;
> > case 'de': ("location: /de/index.php");break;
> > default: ("location: /da/index.html");
> > }
> > ?>
> > </body>
> > </html>
> >
> > BR
> > John
> >
> >
>
> what is this for...somone wanting to show a different page based on the
> user's lang?
Location must be --> header("Location: /path");
<?php
$lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
$mapped = array('en','de','da');
if(in_array($lang,$mapped)){
header("Location: /$lang/index.php");
exit;
}
// default case
header("Location: /your/default/page");
exit;
?>
--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche
Navigation:
[Reply to this message]
|