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 2

 
functions.php file:
<?php

function menuLang(){

global  $_SERVER;

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

return $return;

}//function menuLang


function table ($menu){

extract ($menu);

$return = "<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>";

return $return ;

}//function menu

function config ($lang){


$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",

) ,  

);

$menu = $config [$lang];
return $menu;

}//function config

?>


indexCurrency.php file:
<?php

include "functions.php";

$lang = $_GET['lang'];
if (! $lang) $lang = "en-GB";

$menu = config ($lang);

$content =  "<div>" . menuLang() . "<br>" . table($menu) . "</div>" ;

echo  $content;

?>

indexGold.php file:
<?php

include "functions.php";

$lang = $_GET['lang'];
if (! $lang) $lang = "en-GB";

$menu = config ($lang);

$content =  "<div>" . menuLang() . "<br>" . table($menu) . "</div>" ;

echo  $content;

?>

indexSilver.php file:
<?php

include "functions.php";

$lang = $_GET['lang'];
if (! $lang) $lang = "en-GB";

$menu = config ($lang);

$content =  "<div>" . menuLang() . "<br>" . table($menu) . "</div>" ;

echo  $content;

?>


 
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
If men want to oppose war, it is *statism* that they must oppose.
Ayn Rand, Capitalism, the Unknown Ideal p. 42
The truth is, I often like women. I like their unconventionality. I like their completeness. I like their anonymity.
Virginia Woolf
The choicest thing this world has for a man is affection.
Josiah Gilbert Holland