Hal9000 Posted February 26, 2010 Share Posted February 26, 2010 Hello! My WHMCS is running with several languages, and I want to customize a template file in that it loads a different image depending on the current language. However, is there a variable I can use in the template that contains the current language name? 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 26, 2010 Share Posted February 26, 2010 {$language} 0 Quote Link to comment Share on other sites More sharing options...
Hal9000 Posted February 26, 2010 Author Share Posted February 26, 2010 lol that was easy thank you! 0 Quote Link to comment Share on other sites More sharing options...
HostRW Posted March 20, 2010 Share Posted March 20, 2010 Has the $language variable changed in the latest WHMCS version? I am using following to select either Dutch or the standard language when calling a template: # Define the template filename to be used without the .tpl extension if ($language == "NL-Dutch") { $templatefile = "aboutus-nl"; } else { $templatefile = "aboutus"; } outputClientArea($templatefile); This worked fine until the latest version. Now after displaying the Dutch once it switches back to the default language. Any ideas how to fix this? 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted March 21, 2010 Share Posted March 21, 2010 Try this: if ($smarty->_tpl_vars['language'] == "Dutch") $templatefile = "aboutus-nl"; else $templatefile = "aboutus"; outputClientArea($templatefile); 0 Quote Link to comment Share on other sites More sharing options...
HostRW Posted March 22, 2010 Share Posted March 22, 2010 Hi M00 That works just great, thank you! I also just found a way to select the language in the template using $language and an if statement. So now I have 2 ways to do the job... Hm, which one will I take now... 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted March 23, 2010 Share Posted March 23, 2010 additional question: is the Smarty var $filename new in v4.2.1? 0 Quote Link to comment Share on other sites More sharing options...
HostRW Posted March 23, 2010 Share Posted March 23, 2010 Not sure, but something must have changed as my solution worked fine before the upgrade to v4.2.1 As I asked Matt the same question as above he answered: I don't think $language is a variable that would be defined in custom pages. $_SESSION['Language'] is where the currently selected language is stored if different from the default. Not sure about how to use $_SESSION['Language'] though... 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted March 23, 2010 Share Posted March 23, 2010 (edited) Hi M00 That works just great, thank you! I also just found a way to select the language in the template using $language and an if statement. So now I have 2 ways to do the job... Hm, which one will I take now... That was the actual thing I meant in my first reply, but it will work both. additional question: is the Smarty var $filename new in v4.2.1? No EDIT: Not sure, but something must have changed as my solution worked fine before the upgrade to v4.2.1 As I asked Matt the same question as above he answered: Not sure about how to use $_SESSION['Language'] though... I would recommend to use the language defined inside Smarty. This is just the language how it shows it the customer. Edited March 23, 2010 by m00 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.