Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Dynamic Multi-language site
Old 07-12-2008, 01:07 PM Dynamic Multi-language site
Novice Talker

Posts: 6
Name: Andrew
Trades: 0
I have a site that is translated in 3 languages. English, Korean and Chinese. The users can click on what language they want to view the site on the splash page. The problem I've been running into is if they do not enter through the splash page or type in the exact URL for the homepage including the specific language they get a page with no text. Is there a way that I can make the site default to english if the user enters my site through a backpage? The programmer who did my site has this snippet of coding on most of the pages.

PHP Code:
<?php 
session_start
();
if(
$_SESSION['lang']=='english'){
include_once 
"english.php";
}
else if(
$_SESSION['lang']=='chinese'){
include_once 
"chinese.php";
}
else if(
$_SESSION['lang']=='korean'){
include_once 
"korean.php";
}
$_SESSION['getwill_id']="";
?>
This code is found on the homepage.
PHP Code:
<?php 
session_start
();
$lang=trim($_GET['lang']);
if(
$lang=='e'){
$_SESSION['lang']="english";
}
else if(
$lang=='c'){
$_SESSION['lang']="chinese";
}
else if(
$lang=='k'){
$_SESSION['lang']="korean";
}

if(
$_SESSION['lang']=='english'){
include_once 
"english.php";
}
else if(
$_SESSION['lang']=='chinese'){
include_once 
"chinese.php";
}
else if(
$_SESSION['lang']=='korean'){
include_once 
"korean.php";
}

?>

Last edited by tizpsyko; 07-12-2008 at 01:30 PM..
tizpsyko is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-12-2008, 06:08 PM Re: Dynamic Multi-language site
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
check for the session being blank or not existing and set a default language
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-12-2008, 07:02 PM Re: Dynamic Multi-language site
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
You could also take the default at the users browser default language, so if its chinese it automatically shows in chinese..

As well at the rest, fairly easy code. PM me if you would like it done for you
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 07-13-2008, 07:48 PM Re: Dynamic Multi-language site
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You can use this for your homepage code block:

PHP Code:
session_start();
 
switch (
trim($_GET['lang']))
{
  case 
'c':
    
$_SESSION['lang'] = 'chinese';
    include_once(
'chinese.php');
    break;
 
  case 
'k':
    
$_SESSION['lang'] = 'korean';
    include_once(
'korean.php');
    break;
 
  default:
    
$_SESSION['lang'] = 'english';
    include_once(
'english.php');
    break;

And this for your other page block:

PHP Code:
session_start();
 
switch (@
$_SESSION['lang'])
{
  case 
'chinese':
    include_once(
'chinese.php');
    break;
 
  case 
'korean':
    include_once(
'korean.php');
    break;
 
  default:
    include_once(
'english.php');
    break;
}
 
$_SESSION['getwill_id'] = ''
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Dynamic Multi-language site
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33382 seconds with 12 queries