This is a discussion on Help with a website within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hello! I'm trying to make a website like this in PHP if possible: 1. It will be multilanguage website ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello!
I'm trying to make a website like this in PHP if possible: 1. It will be multilanguage website When you enter the site there will be 3 or 4 flags. When you click on the English flag, the entire website will be in English or if you want it to be French you click on the French flag and everything will be in French. (I think I could figure this out by myself but any help would be much appreciated.) 2. Now this is the hard part. At least for me. In the right bottom corner there would be a map of Europe with all of the countries. And when you'd go over a country with your mouse a flag and a country name would show up on the map and in the left top corner a description of this country (some text). Help me please! |
|
|||
|
<belovah@gmail.com> wrote in message news:1139410105.534444.195640@g44g2000cwa.googlegr oups.com... > Hello! > > I'm trying to make a website like this in PHP if possible: > > 1. It will be multilanguage website > When you enter the site there will be 3 or 4 flags. When you click on > the English flag, the entire website will be in English or if you want > it to be French you click on the French flag and everything will be in > French. > (I think I could figure this out by myself but any help would be much > appreciated.) > > 2. Now this is the hard part. At least for me. > In the right bottom corner there would be a map of Europe with all of > the countries. And when you'd go over a country with your mouse a flag > and a country name would show up on the map and in the left top corner > a description of this country (some text). > > > Help me please! > There is two ways... both will require you to enter your entire text in each language in either a database table/s or in conditional PHP statements on every page. You would then store the language selected as a master global variable which you read in on the display of every page. |
|
|||
|
On Wed, 08 Feb 2006 06:48:25 -0800, belovah wrote:
> Hello! > > I'm trying to make a website like this in PHP if possible: > > 1. It will be multilanguage website > When you enter the site there will be 3 or 4 flags. When you click on the > English flag, the entire website will be in English or if you want it to > be French you click on the French flag and everything will be in French. > (I think I could figure this out by myself but any help would be much > appreciated.) You should seriously consider using your server's language negotiation facilities. This will avoid any conditional PHP/database-driven solutions. -- Ben. |
|
|||
|
When the user clicks a flag, set a cookie called "lang" to an ISO
language code (or language/country code pair). For example 'en' for english (or en-us for United States English). If the request contains HTTP headers which identify the user's native language (as most do) you can use that as a default and make the flags page optional. At the top of every page do this: <script src="/languages/<?php echo $_COOKIE['lang']; ?>_strings.js" language="javascript"> Then create a folder called languages in your wwwroot. Inside this folder create a .js file for each language, for example: /language/en-us_strings.js /language/fr-fr_strings.js /language/es_sp_strings.js ....and so on... Within each file define some VARs for each country. For example: en-us_strings.js: var us_name = 'United States'; var us_desc = 'Population: about 350 Million and so forth...'; var sp_name = 'Spain'; ....and so on... On page load build a polygon-based image map using PHP. Pull the shape of each country from a database. Good luck finding such a database (I'm sure something like this exists). Meanwhile on the client side... Then on the onmouseover and onmouseout for each image map region swap out the innerHTML property of a DIV at the top of the page with the associated country_name variable defined by the .js file inserted. If this post made no sense don't blame me. Blame it being 1:00am and my lack of sleep. ;o) -Robert |
![]() |
| Thread Tools | |
| Display Modes | |
|
|