bilingual site, url link redirecting to proper directory

Links for php scripts

Moderators: egami, macek, gesf

Post Reply

Wed Apr 09, 2003 1:05 pm


Would someone know how I may allow a link to be clicked on so that a web visitor could either choose to display the page in English or French ?? (switching directories from to ??

actually, the root directory read the French pages and the /en reads the English pages.

Hope I ll get a quick answer )

User avatar
New php-forum User
New php-forum User
Posts: 37
Joined: Wed Apr 02, 2003 1:31 am
Location: Hythe, UK

Thu Apr 10, 2003 12:21 am

You could set a cookie once they've chosen their preference
such as:


// $HTTP_GET_VARS[$language] = "en" or ""


## Register the input with the value

if ($HTTP_GET_VARS[$language] && !$HTTP_SESSION_VARS[Language]) {

$Language = $HTTP_GET_VARS[$language];

## Create new Session Values

} else {

$Language = "en/";



Then make sure links have this:

<a href="<?=$Language ?>page1.htm">click here</a>

Hopefully this makes sense...


Fri Apr 11, 2003 5:00 am

Thanks and hello Mammal! :)

If I tackle the problem like this it means I actually have to hard code in each page! the corrsponding link which actually eliminates the benefit of the script??

To get a god undestanding of the issue you can peak at:


Post Reply