Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Two Langauges, One Site...
01-24-2008, 05:48 AM #1
- Join Date
- Aug 2007
- Thanked 0 Times in 0 Posts
Two Langauges, One Site...
I have made a CMS for a site where the admin can update text content on the home page....
They login to the admin panel and enter a title, and the body.
However, the client wants to offer two languages now. One English, and one French..
Therefore, I made the database changes by adding one extra field called body_french and changed body to body_english...
Now the admin enters the body for both english and french...
The problem comes when I display the database information on the home page.
How should I allow the client to select between English and French?
Should I use sessions? Or should I use a simple PHP If else fucntion?
Also, if I use sessions, can someone direct me how to start? I have never used sessions.
01-24-2008, 06:16 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Sessions. And if the users create accounts, store it with the account.
As for changing it, its a simple matter of adding a link for it.
Lets take for example to go to french:
If you put the control for it in a seperate inclusion file, say global.php:
Sort of idea. You would use the condition that if no session language exists to use english, otherwise use whatever is specified. I assume you got the linguistics already scripted and just need the condition / session usage yeah?PHP Code:
$lang = strtolower($_GET['chgLang']);
$_SESSION['language'] = 'french';
$_SESSION['language'] = 'english';
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');