Forum Moderators: coopster
this site is in two languages arabic and english as well. plz help me... thanx
[edited by: coopster at 2:08 pm (utc) on July 25, 2005]
[edit reason] removed url per TOS [webmasterworld.com] [/edit]
1. You can use templates and fill them in with correct language
2. You can use includes for various languages
You can use db to store language data
Really depends on the type of the page. Wheather it's different language articles or informational page.
If the page is small I recommend using includes. If it's big then change to templates and db
best regards
michal Cibor
e.g. "<b>$1</b>";
At the top of your page, include a specific language file:
include("/languages/$language.php");
The language file is of the format:
$1="Something";
$2="Something else";
You then need to decide which language to include. Try using GET to start with, then extend it to use SESSIONS once you've figured out GET.
$language=$_GET['language'];
include("/languages/".intval($language).".php");
Now, if you have three languages, language files named 1.php, 2.php, 3.php
You can load the corret language as:
http:// yoursite .com/ index.php? language=1 (or 2 or 3)
<!DOCTYPE....
<head...
<title><?php echo $template["title"];?></title>
...
<body><p class="menu"><a href="contacts.php?lang=<?php echo $lang;?>"><?php echo $template["menu_contact"];?></a></p>etc...
index.php:
<?php
//get language:
if(!($_not_validated_lang = $_POST["lang"])) $_not_validated_lang = $_GET["lang"];
//validate it:
switch ($_not_validated_lang) {
case "de" :
case "pl" :
case "it" :
$lang = $_not_validated_lang; break;
default :
$lang = "en"; }
//get info from db for specified language
$sql = "SELECT * FROM template WHERE language='$lang'";
//connect, query and use mysql_fetch_assoc() to get $template
//then
include("template_index.php");
?>
i create a page in arabic as follow:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html>
<head>
</head>
<body>
دسم قليل ورشاقة أكثر
</body>
</html>
but its explorer scroll bar is on the right which is for english language that sould b on tihe left side plz help me...
Best would be to go to some arabic page and see the source code.
Best regards
Michal Cibor