> Is it possible in php to write this so that, if there's a directory for
> the specified language then it's used, so that we don't have to list all
> of the language codes in this php file?  Otherwise, each time we add a
> language we have to remember to edit this file...
> 
> Doug

I'm not able to test this at work but I have added to Stefan's code and used
the php file_exists function to check whether an about.html exists for the
language concerned and redirect if so.

Guy


<?php
//check first to see if they've been nice and 
//set the language 

if (isset($_SERVER["HTTP_ACCEPT_language"])) {

        //grab all the languages
        $langs=explode(",",$_SERVER["HTTP_ACCEPT_language"]);
        
        //start going through each one
        foreach ($langs as $value) {
        
                //select only the first two letters
                $choice=substr($value,0,2);
                
                //check if a docs/XX/about.html exists for this language
                $pathname = "/docs/".$choice."/about.html";
                
                if (file_exists($pathname)) {
                   Header("Location: ./".$choice."/");
                   exit;
                }
        }
        //if we get here then redirect to the default
        Header("Location: ./en/");
        exit;
}

//If the language is not set then use this 
//as default 
else {
        Header("Location: ./en/");
}
?>




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Nutch-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to