Page 1 of 1

languages redirection 2

Posted: Sun 5. Sep 2004, 15:07
by b.r bruss
well I tried the Papnase code and it doesn't work as well.

Code: Select all

[PHP] 
if(!$GLOBALS['aktion'][0]) { 
    
   switch(strtolower( substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ) ) ) { 
       
      case 'de':   header('Location: '. $GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?deutsche_version'); 
                exit(); 
                break; 
    
       default:    header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?english_version'); 
                  exit(); 
  } 
} 
my index page is not wcms, but index.htm.
My wcms is located in a subfolder. Should I paste the languages redirection in my index.htm?

Posted: Mon 6. Sep 2004, 10:06
by brans
this will only work if you paste the code into your index.php template of pwpcms and you link directly from the index.htm to the index.php

Code: Select all

<a href="subfolder/index.php">Your Wcms Installation</a>
But if you already got an index.htm you could easily make your users choose between the languages by buttons... simply add some flags and link them correctly... that would be the most easy and efficient way to go because the image direction works only if there is set the correct system language:

f.e.: If ppl set english as their browserlanguage they will be redirected to the english version of your homepage but it is possible that they are using a german version of Windows or their OS....

most ppl even don't recognize that they have set the wrong browser language...

Posted: Tue 7. Sep 2004, 03:09
by b.r bruss
yeah, you're right, but i wanted to use the script since it's more technically cool :D
This is the easiest way
T.Y.