TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login GOLD PRICE, RATE
login HOROSCOPE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login FINANCE, BUSINESS
login WORLD COUNTRIES, WIKI

PHP scripts, code, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

PHP. Multi language website example

 
<a href = "<?php echo $_SERVER['PHP_SELF'] ; ?>?lang=en-GB">EN</a><br>
<a href = "<?php echo $_SERVER['PHP_SELF'] ; ?>?lang=lt-LT">LT</a><br>
<a href = "<?php echo $_SERVER['PHP_SELF'] ; ?>?lang=ru-RU">RU</a><br>

<?php

$lang = $_GET['lang']; // Kalbos kintamasis "en", "lt", "en-GB", "lt-LT", "ru-RU"

$config = array (

"en-GB"=>array(

"meniuLink1"=>"HTTP://en",
"meniuLink2"=>"HTTP://en",
"meniuLink3"=>"HTTP://en",
"textLink1" =>"en",
"textLink2" =>"en",
"textLink2" =>"en",

),

"lt-LT"=>array(

"meniuLink1"=>"HTTP://lt",
"meniuLink2"=>"HTTP://lt",
"meniuLink3"=>"HTTP://lt",
"textLink1" =>"lt",
"textLink2" =>"lt",
"textLink2" =>"lt",

),

"ru-RU"=>array(

"meniuLink1"=>"HTTP://ru",
"meniuLink2"=>"HTTP://ru",
"meniuLink3"=>"HTTP://ru",
"textLink1" =>"ru",
"textLink2" =>"ru",
"textLink2" =>"ru",

) ,  

);


if (! $lang) $lang = "en-GB"; // kalba pagal nutylÄ—jimÄ…

$meniu = $config[$lang];

echo "<table><tr>
<td><a href = \"{$meniu['meniuLink1']}\">{$meniu['textLink1']}</a></td>
<td><a href = \"{$meniu['meniuLink2']}\">{$meniu['textLink2']}</a></td>
<td><a href = \"{$meniu['meniuLink3']}\">{$meniu['textLink3']}</a></td>
</table>";


extract ($meniu);

echo "<table><tr>
<td><a href = \"$meniuLink1\">$textLink1</a></td>
<td><a href = \"$meniuLink2\">$textLink2</a></td>
<td><a href = \"$meniuLink3\">$textLink3</a></td>
<tr></table>";

?>
 
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
The greatness of a nation and its moral progress can be judged by the way its animals are treated.
Ghandi
Men willingly believe what they wish.
Julius Caesar, De Bello Gallico
A confession has to be part of your new life.
Ludwig Wittgenstein