Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Location
    Graz, Austria
    Posts
    81
    Thanks
    2
    Thanked 1 Time in 1 Post

    bilingual site navigation problem

    hi!

    I am maintaining an English website and now want to add a German version.
    I plan to add an extra folder, where the German pages are located, and the user can choose his language at an entry page.

    The problem now is, that there is a guestbook, which should be accessible from both versions. But all the links in the guestbook are pointing to the English version although German visitors should be directed back to the German version.

    I know that it is possible to achieve this serversided, but actually have no clue, how I can code this.

    Thanks for your help in advance!
    webmaster and member of
    http://cashfromchaos.net

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    personally I would set up so the site uses the same pages for all the site. Then use different sub domains to determine which language to echo back through the pages.

    PHP Code:
    <?PHP
    function get_subdomain() {
        
    // Explode the HOST into it's constituent parts:
        
    $parts explode('.'$_SERVER['HTTP_HOST']);
        
    $cp count($parts);

        
    // If a 1 part hostname like 'localhost' don't bother with a subdomain:
        
    if ($cp == 1) { $subdomain ''; }
        
    // Otherwise, generate our subdomain by using the last 2 parts
        
    else { $subdomain ".{$parts[$cp-2]}.{$parts[$cp-1]}"; }

        return 
    $subdomain;
    }


    $subdomain=get_subdomain();
    if (
    $subdomain=='uk')
    {
     echo 
    'Welcome to Uk site';
    }elseif (
    $subdomain=='de')
    {
     echo 
    'Welcome to German site';
    }


    ?>
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •