| | |
Multiple languages site?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hello all..
Tel me how to create a site with different languages, if user select particular language, then all the content will be displayed in that language...
How to do it???
or
Any predefined free software available on the internet...
Any resources or information would be appreciated....
Thanks..
Shanti.
Tel me how to create a site with different languages, if user select particular language, then all the content will be displayed in that language...
How to do it???
or
Any predefined free software available on the internet...
Any resources or information would be appreciated....
Thanks..
Shanti.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Oct 2007
Posts: 38
Reputation:
Solved Threads: 1
I would normally just create a PHP file of definitions... name it after the language and include the correct file...
that way your code will never have to change and it's kept simple... i guess the only problem would be including variables... but depending on the type of site you have it may or not be a problem
if you needed variables within your output text I would then consider setting up a languages table in a database setup something like
ref | lang | output
then make a function called display() that would be called like
which would be defined like
and welcome in the db would look like
ref | lang | output
welcome | en | Hi $var1, how the hell are you
this code is scribbled and i wouldn't use it, just to give you a rough idea.
that way your code will never have to change and it's kept simple... i guess the only problem would be including variables... but depending on the type of site you have it may or not be a problem
if you needed variables within your output text I would then consider setting up a languages table in a database setup something like
ref | lang | output
then make a function called display() that would be called like
PHP Syntax (Toggle Plain Text)
echo display('welcome');
PHP Syntax (Toggle Plain Text)
function display($ref, $var1) { global $lang; $info = mysql_fetch_array(mysql_query("select from languages where lang='$lang' and ref='$ref'")); $output = preg_replace($info['output']); // find out the regex to pickup and convert variables return $output; }
ref | lang | output
welcome | en | Hi $var1, how the hell are you
this code is scribbled and i wouldn't use it, just to give you a rough idea.
![]() |
Similar Threads
- Looking for web developers in Delaware (Web Development Job Offers)
- Russian/Asian brides dating site promotion (Promotion and Marketing Plans)
- "Forbidden / You don't have permission to access / on this server." error (Linux Servers and Apache)
- site no.of visitors improving PHP (PHP)
- Need help for a paper (IT Professionals' Lounge)
- cPanel Special: Buy 1 Month & Get Your Next Month FREE by AllureHost.com (Web Hosting Deals)
- another newbie with alot of redhat and apache server Q'S (Linux Servers and Apache)
- a few search engine optimization questions (Search Engine Optimization)
Other Threads in the PHP Forum
- Previous Thread: how to display calendar through php in html table
- Next Thread: Multiple files Upload plz HelP
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






