HTTP_ACCEPT_LANGUAGE: problems with implementing

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
opawaldburger
Forum Members
Forum Members
Posts: 94
Joined: Tue Nov 04, 2008 2:10 pm

HTTP_ACCEPT_LANGUAGE: problems with implementing

Post by opawaldburger »

hi friends,

i've got a problem implementing an automatically language-detection on my side. it does not work. i have got a german side (benjamin-karl.com/de) and an english one (benjamin-karl.com/en). maybe i do something completly wrong, so i just write what i'm doing:

i take the script from the internet and paste it into a template (i call it "start"). then i create a new side using the start-template.

now when i open the side benjamin-karl.com/start nothing happens. usually when i open the side, the script should redirect me to the german side, but it doesn't. here's the script i'm using but i don't think that's the weak point!

Code: Select all

<?php
{
$lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
if (substr($lang, 0, 2) == 'de')
{
header("Location: index.php?page=de");
} else {
header("Location: index.php?page=en");
}
}?>
what could possibly be wrong or which is the mistake am i doing?

greez, toby
Last edited by opawaldburger on Sat Mar 14, 2009 9:09 pm, edited 1 time in total.
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!
Post Reply

Return to “Developers Discussion”