Help with a website

0 views
Skip to first unread message

belovah

unread,
Feb 8, 2006, 9:54:02 AM2/8/06
to PHP Hacks
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!

Michael

unread,
Feb 16, 2006, 3:19:37 PM2/16/06
to PHP Hacks
Ok, use cookies for you first one.

For the second one, you should use Javascript or some HTML for that,
pop over to http://groups.google.com/group/comp.lang.javascript and
they should give you a hand.

Cruella DeVille

unread,
Mar 1, 2006, 5:16:37 PM3/1/06
to PHP Hacks
To your question no 2 I have no solution, but for your question no 1
this is one way:

You must keep track of the preferred language somehow. For that you
could use a session variable.
Then all your output is put in a language array or as constants -
perhaps one file for each language. If you use a language array you
could use an assosiative array like this:

<eng.php> (filename>
$language['hello'] = "Hello";
$language['welcome'] = "Welcome;

<french.php>
$language['hello'] = "Bon jour";
$language['welcome'] = "some french";

<norwegian.php>
$language['hello'] = "Hei";
$language['welcome'] = "Velkommen";

And so forth and so on

And in your script you call them as a ordinary variable and in
session['language'] you store the chosen language and includes correct
file.

$_SESSION['language'] included norwegian.php

print $language['hello']; // outputs "Hei"

The other option is also using sessions, but here you use constants
instead of an array.
<french.php>
DEFINE('HELLO', 'Bon jour');
DEFINE('WELCOME', 'some french');

calls it like this:
print HELLO;

Reply all
Reply to author
Forward
0 new messages