redirect using HTTP_ACCEPT_LANGUAGE
-
I’m trying to read / set http_accept_language to:
1) give users text in their browser default language;
2) give them the option of changing to another language.
My code works fine:
https://oreneta.com/kalebeul/test.php
but dies once it goes into a WordPress template (same code/text near bottom right-hand column):
https://oreneta.com/kalebeul/2006/10/13/2000-catalan-insults/
Here’s my code:
<?php
$day=(date('d'));
$month=(date('m'));
if ($userlang=="")
{
$userlang=$_SERVER['HTTP_ACCEPT_LANGUAGE'];
$userlang=substr($userlang,0,2);
}
if ($userlang=="es")
{
include("https://oreneta.com/libro_verde_bcn/es/$month/$day/");
echo "(<small><a href="?userlang=en">Traducción</a>)</small>";
}
else
{
include("https://oreneta.com/libro_verde_bcn/en/$month/$day/");
echo "(<small><a href="?userlang=es">Original</a>)</small>";
}
?>Any ideas? I thought at first it was a register globals thing, but not sure now.
- The topic ‘redirect using HTTP_ACCEPT_LANGUAGE’ is closed to new replies.