Jump to content

Change Web Site Country


totote14

Recommended Posts

Hi to everyone, i´m developing this website for a corporation with offices in two diferent countries, so i have a select for choosing the country site to visit.

Now i want to change the phisycal directory of the files when i change the optin of the select, so i can reload the other country´s page from this other directory.

I was trying to do this whith a session var (php) and send it in a javascript function on the onchange event, i don´t know if this is the best option or is there another better?

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/216400-change-web-site-country/
Share on other sites

I'm not sure of the exact code, but you can use $_SERVER['HTTP_ACCEPT_LANGUAGE'], or maybe some other _SERVER vars to detect the language preference of the user.

 

So basically, try to get their language, check it against an array of what languages you allow, if in the array then set their session or whatever to that language, else set it to the default language. ("en" I would assume)

 

Hope this help,

Alan.

Thanks, but that´s not what i want to know how to do, what i ment is that i have two directories of pho an html files which have the same name but differnt content, one of the directory is for one of the corporation site for contry one (let´s call it this way) and the other directorye contains the page for the of the second country.

So, in this select i haver the two country names as options, so what i´m tryng to do is when the user changes de country option of the select, the page is reload whith the info of the country selecte, so the page that is loades is in the directory that belongs to the country selected.

 

Thanks,

Oscar.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.