I would like to know how is made languge system based on variable, where you type for example $name="something" put in file eng.php and then get out and print.
PHP language
Started by Latinoking, Sep 06 2007 02:01 AM
2 replies to this topic
#1
Posted 06 September 2007 - 02:01 AM
#2
Posted 06 September 2007 - 06:35 AM
[quote name='Latinoking' post='234569' date='Sep 6 2007, 07:01 AM']I would like to know how is made languge system based on variable, where you type for example $name="something" put in file eng.php and then get out and print.[/quote]
I LatinoKing, you would do this using the require() or include() functions and a case statement, according to a posted variable.
(I'm using no reference so do not just directly copy this code and use it, re-make it to the specifics of your requirement. This text is just a guideline to help you.)
Imagine a user goes to you index page and has an option to select language, e.g
<a href="index.php?lang=eng>English</a>
<a href="index.php?lang=fra>French</a>
You would have the if statement in your index file like so:
$lang = $_POST["lang"];
switch ($lang)
{
case eng:
include(englishfile.php);
break;
case fra:
include(frenchfile.php);
break;
default:
echo "Please select a language";
echo "
<a href="index.php?lang=eng>English</a>
<a href="index.php?lang=fra>French</a>
";
";
}
I LatinoKing, you would do this using the require() or include() functions and a case statement, according to a posted variable.
(I'm using no reference so do not just directly copy this code and use it, re-make it to the specifics of your requirement. This text is just a guideline to help you.)
Imagine a user goes to you index page and has an option to select language, e.g
<a href="index.php?lang=eng>English</a>
<a href="index.php?lang=fra>French</a>
You would have the if statement in your index file like so:
$lang = $_POST["lang"];
switch ($lang)
{
case eng:
include(englishfile.php);
break;
case fra:
include(frenchfile.php);
break;
default:
echo "Please select a language";
echo "
<a href="index.php?lang=eng>English</a>
<a href="index.php?lang=fra>French</a>
";
";
}
Edited by Booj, 06 September 2007 - 06:35 AM.
#3
Posted 06 September 2007 - 04:43 PM
Or you could do it a bit more of a complicated, but professional way...
http://www.13dots.co...?showtopic=2535
Oh, by the way. I found this tutorial by searching P2L...
http://www.13dots.co...?showtopic=2535
Oh, by the way. I found this tutorial by searching P2L...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
