Jump to content

Getting current language in Templates?


Hal9000

Recommended Posts

  • 4 weeks later...

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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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 by m00
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated