I would create a session variable telling which language has been selected and then passing it throughout the site.
Would be interesting to put a cookie, so the language will be automatically selected next time.
Then put all texts of the site in a single php file with the same name of the language: (then you'll have to
#include it in each page)
english.php
- Code: Select all
$lang['hello'] = 'Hello %';//% is the output of a prinf statement, which in this case would be the name of the user for example
$lang['wellcome'] = 'Wellcome to my website!';
$lang['bye'] = '<b>Thank you</b> for visiting our site!';
spanish.php- Code: Select all
$lang['hello'] = 'Hola %';//% is the output of a prinf statement, which in this case would be the name of the user for example
$lang['wellcome'] = 'Bienvenido a mi página!';
$lang['bye'] = '<b>Gracias</b> por visitar nuestra web!';
This would be for the text of your pages.
The contents I would keep them in the database.
*
articles table: (an example)
id -
article_name_spanish -
article_name_english -
art_contents_spanish -
art_contents_englishThe other way would be separating each language in a table for each section, but it would cause a lot of tables..
It's your choice...
The gifs,
just create an image folder
images and subfolders
spanish,
english, and so on..
The gifs names will be the same in each folder.
To call images, then use this:
- Code: Select all
echo "<img src='images/'".$HTTP_POST_VARS["language"]."/icon.gif>";
bye!