algeriano Posted December 25, 2012 Share Posted December 25, 2012 Hello, I want to ask you how to redirect a user according to his browser language..i want to redirect users according to their browsers language to either french or english and not only this i want to redirect them too to a translated template with specific language for exemple if a french visitor comes to my sites it will be redirected to whmcs french with a template too translated in french and if he is an english visitor he will be redirected to english whmcs with english template how can i do it please? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted December 25, 2012 Share Posted December 25, 2012 You could try with something like this: $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); switch ($language ){ case "en": header("Location: index.php?language=english"); break; case "fr": header("Location: index.php?language=french"); break; case "it": header("Location: index.php?language=italian"); break; default: // Here i set the default language header("Location: index.php?language=english"); break; } But i would go for a while cycle between all active languages on WHMCS so that when you add/remove languages you don't have to update the script because it's all dynamic. Anyway this file should be included in the header. 0 Quote Link to comment Share on other sites More sharing options...
algeriano Posted December 26, 2012 Author Share Posted December 26, 2012 Thank you but how to create this file and how can i include a php file in the header it's impossible!!!please explain! And for the template? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted December 27, 2012 Share Posted December 27, 2012 With Smarty include in header.tpl {include_php file='yourfile.php'} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.