Jump to content

Henk de Wit

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by Henk de Wit

  1. I’m using a multilanguage script to change from lanquage. Now I’m having troubles to change from a language when I’m at the default language (English) The site looks like: example.com ( Main directory) example.com/fr/ example.com/es/ When I’m at example.com/fr/blabla/index and I want to go to example.com/es/blabla/index it works fine. But when I’m at example.com/blabla/index and I want to go to example.com/fr/blabla/index . I’m redirect to example.com/fr/index I’m using: <?php function switchLanguage($lang) { $u = explode('/', $_SERVER['REQUEST_URI']); $u[1] = $lang; return implode('/', $u); } ?> So it’s logic that I’m not redirect to the correct path because there is no directory /eng. I was thinking is it possible to rewrite the url using a array? Something like this: <?php function switchLanguage($lang) $array1 = array(' ', $_SERVER['REQUEST_URI']); $array2 = array('$lang', ' '); $newArray = array_combine($array1, $array2); foreach ($newArray as $key ) { echo "$key $value"; } ?> But how can I get the value in a url or where Am I going wrong. To use a database or .ini and geoip caching is not an option
×
×
  • 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.