Help in doing a double language homepage based on IP location

3 replies
hallo
How can I choose which page to show based on visitor's location?
I mean, I want to prepare two version of the homepage (say Example Domain )

- Version A, for visitors being in the US
- Version B, for visitors being outside US

How can I do it?

Thank you
#based #double #homepage #language #location
  • Profile picture of the author Rus Sells
    I bet there's a Google translate widget or tool you can put on your site that identifies the geo location of your visitors and will let them translate the site into their language.
    {{ DiscussionBoard.errors[9057992].message }}
    • Profile picture of the author durandal
      Originally Posted by Rus Sells View Post

      I bet there's a Google translate widget or tool you can put on your site that identifies the geo location of your visitors and will let them translate the site into their language.
      thank you but the 2 version of the page must be completely different, not just a translation of the other
      {{ DiscussionBoard.errors[9057994].message }}
  • Profile picture of the author StanHyeck
    The way I would do it is like so:
    1) index.php for your site uses the geoIP classes to determine a users location
    A good tutorial is here: Geolocation: Easier Than It Looks « php[architect] – Magazine, Training, Books, Conferences

    2) Use "require_once" to pull the appropriate html page and simply "echo" that page to the user


    ANOTHER OPTION


    1) index.php uses geoIP to determine users location

    2) The page you want to display is already in the index.php ... HOWEVER any text the user sees has php variables in that location. (doing it this way the page stays in your language but a user might see some other language

    3) Pull from a database the text based on the variable and geoIP information. Put text to display to user into the variables

    4) display the page

    Either route would let you fairly easily add new languages to display as you wanted.


    Hope this helps
    {{ DiscussionBoard.errors[9058040].message }}

Trending Topics