Some of the clients I work(ed) for have multi langual websites, therefore I created a solution to redirect the visitor to the right language on the website. I did solve this problem by inspecting the language of the browser from the visitor.
The first step is to create your structure in MODx. In this example we have to languages and to accomplish that I set up this structure:
You have to place the FirstChildRedirect snippet on the pages "nl" and "en" by entering it into the content field. This snippet redirects to the first page in the folder. You don't need to install the snippet, it is shipped with the MODx download.
Now we create a new snippet to get the browser language and redirect the visitor to the page. Let's call this snippet "languageforwarder" and put this into it:
The number in the $modx->makeUrl function is the id of the folder that contains the pages for that language. All what's left to do is calling this snippet from the site_start page, which is "languageforward (1)" in this example.
Now the visitor should be redirect to the right language if you have done everything right.
Write a comment
Posts: 4
Reply #1 on : Fri June 19, 2009, 16:13:30
Posts: 2
Reply #2 on : Fri June 19, 2009, 16:27:27
Posts: 4
Reply #3 on : Thu October 22, 2009, 12:58:00
Posts: 4
Reply #4 on : Mon February 08, 2010, 12:03:17