Language variable not working

Language variable not working

Postby frank24 » Tue Aug 11, 2009 4:37 pm

Hi to all the Availability Calendar team,

I'm a bit confused by a problem I have with Availability Calendar. I run it on a multilingual site with English and French.

I had it up and working no problem but recently I changed hosting company and I can't get it to work again :/

When I load either the front-end or the admin page, I get ".lang.php not found".

In index.php, the include for the language file is like this;
$the_file="./lang/".DIR_LANG.LANG.".lang.php";

With my previous hosting company, this line would successfully find the file /lang/en.lang.php or /lang/fr.lang.php . But now, it seems as if the language variable doesn't return anything. The script seems to be looking for the file "/lang/.lang.php" without adding the EN or FR.

Does anybody know what might be causing this?

Let me know :)
Frank
frank24
 
Posts: 3
Joined: Mon Apr 27, 2009 5:41 am

Re: Language variable not working

Postby frank24 » Tue Aug 11, 2009 4:51 pm

(sorry, edited)

still having the issue.
frank24
 
Posts: 3
Joined: Mon Apr 27, 2009 5:41 am

Re: Language variable not working

Postby chris » Tue Aug 11, 2009 5:12 pm

Hi there,

The LANG constant is either hardcoded into the calendar php file or tries to get the value sent to the page.
In the code I used $_REQUEST to read this value as this reads both $_GET values and $_POST values.
These are the lines that do this:
Code: Select all
if(isset($_REQUEST["lang"]))         define("LANG",      $_REQUEST["lang"]);      #   lang sent by url, form session etc
else                           define("LANG",      DEFAULT_LANG);         #   default lang defined in config.inc.php


I have never heard of this happening, but, is it possible that your new server has $_REQUEST disabled?

Try changing the line:
Code: Select all
if(isset($_REQUEST["lang"]))         define("LANG",      $_REQUEST["lang"]);      #   lang sent by url, form session etc

to
Code: Select all
if(isset($_GET["lang"]))         define("LANG",      $_GET["lang"]);      #   lang sent by url, form session etc


How are you actually defining the language variable?

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Language variable not working

Postby frank24 » Tue Aug 11, 2009 5:34 pm

Hi,

You're a genius, I changed the code as you suggested and it worked.
To answer your question, I simply call the language in the URL like this: "index.php?months_to_show=2&lang=fr".

To thank you, I'm buying you a pint over paypal :)
See you,
Frank

(frank's not my real name as you'll see in paypal! hehe)
frank24
 
Posts: 3
Joined: Mon Apr 27, 2009 5:41 am

Re: Language variable not working

Postby chris » Tue Aug 11, 2009 5:45 pm

Hey, thanks, just got the paypal email and was wondering who it was from - thanks a lot :)

Strange problem you have had there, I have never known of $_REQUEST not to work.
I use it all the time rather than $_GET or $_POST (other than for data that I know should have been sent via $_POST as it is more flexible. I can't imagine why a host would disable it.

Anyway, I am glad that you got it working :)

Chris

By the way, hang around for the new version, you can see it in action (though not ready for downloading) [url=http://www.cbolson.com/sandbox/availability-calender/v3.0/]here[/chris]
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

cron