1 problem + 1 question

16 views
Skip to first unread message

Brian

unread,
Mar 10, 2010, 6:08:34 AM3/10/10
to Ajax Availability Calendar
Dear Chris,

I'm sorry to bother you again, but I've come across a couple of small
issues whilst adapting your fabulous script to my client's wishes.

First a small problem:
I've added extra language files for Dutch, French and German. Accents
and umlauts come across fine when entered into the basic language
translation section (ie for months, etc.). However when I use 'fermé'
for closed in the Booking States, the character é is displayed as 'é'
in the resulting Legend table.

... and then a question/request:
My client's site is split into 4 according to an initial language
choice. When opening the page containing the availability calender, is
it possible to force the language of the calender to a particular
language, rather than have the language pull-down menu? I tried
changing

var lang = '<?php echo LANG; ?>';

to

var lang = 'nl'; (or whichever other language code)

but this only successfully pre-set the language of the calender itself
and not the Booking Item or Booking States.

I'd be very grateful (again) for your thoughts.

Many thanks for your time.

Brian

cbolson

unread,
Mar 10, 2010, 6:47:55 AM3/10/10
to Ajax Availability Calendar
>... However when I use 'fermé'

> for closed in the Booking States, the character é is displayed as 'é'
> in the resulting Legend table.
Hmmm, works fine in my version (just checked)
Have you checked what charset your page is using?
My version is using "utf-8":
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


As regards the language, appending &lang=nl to the url or hardgoing it
into the page that shows the calendar like this:

$_REQUEST["lang"]="nl";

should work (place this BEFORE you include the calendar file).

Note - This is one of the things that I need to simplify for the next
release version.

Chris

Brian Galliford

unread,
Mar 10, 2010, 7:22:24 AM3/10/10
to ajax-availabi...@googlegroups.com
Hi Chris,

you're a genius!! I'm very grateful for your swift and clear reply.

Changing the charset for the page certainly solves the problem, although it remains strange that the és and û in the calendar were displayed perfectly, but those coming from the booking state didn't. Enfin - problem solved.

Also adding ?&lang= ... to the url does the job perfectly.

Incidentally I was unable to delete Spanish via the 'legal' route in the language admin section, so had to manually delete the language file from the server and remove the database tables. Once they're completed, if you'd like to include the language files I've made as standard with the program (Dutch, German and French) - I'll be more than happy to send them to you.

May I please bug you with one last question and then I think I can leave you in peace?

Underneath your calendar I've added a reservation form, as you can see here:
http://www.laserenade.eu/ls_resEN.php?&lang=en

I'm using the following script to send the form and return a 'Your reservation has been sent' message:

<?php
extract($_REQUEST);

if(isset($submit)) {
$body = "\r\nLa Serenade Reservation:\r\n\r\n $Achternaam\r\n ".
"$Voornaam\r\n $Email\r\n $Telefoon\r\n $Data\r\n $Wensen\r\n";
mail( "in...@laserenade.eu", "La Serenade Reservation Form", $body, "Van: in...@laserenade.eu" );
mail( $Email, "La Serenade Reservation Form", $body, "Van: in...@laserenade.eu" );
$status = '<br><b><font color="red">Your reservation has been sent. Many thanks!</font><br><br>';
}
?>
<?=$status?>

If these lines are placed after the calendar script before the form - eveything works fine, except that the Thankyou message is displayed too far down the page. So I moved the script up before the calendar script. As a result the calendar still works perfectly, but the roll-over texts for month forward/backward and the 'Last update' text are reduced to an 'e'. In the grand scheme of things not of vital importance, but a niggling don't-know-why which I can't seem to solve. Any thoughts?

Once again - very many thanks for your assistance.

Best wishes

Brian

> --
> You received this message because you are subscribed to the Google Groups "Ajax Availability Calendar" group.
> To post to this group, send email to ajax-availabi...@googlegroups.com.
> To unsubscribe from this group, send email to ajax-availability-c...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ajax-availability-calendar?hl=en.
>
>
>

Brian Galliford

unread,
Mar 10, 2010, 7:40:23 AM3/10/10
to ajax-availabi...@googlegroups.com
Hi Chris,

Just further to what I've just described with the placement of my extra message sending script ... now I've finished the pages for all 4 languages, the 'e' appears to be the first letter of the language code, ie changes to 'f', 'd' and 'n'. Curiouser and curiouser!

Yours gratefully

Brian

cbolson

unread,
Mar 10, 2010, 8:12:19 AM3/10/10
to Ajax Availability Calendar
> Changing the charset for the page certainly solves the problem, although it remains strange that the és and û in the calendar were displayed perfectly, > but those coming from the booking state didn't. Enfin - problem solved.

This is because the "normal" texts are defined in a text file whereas
the booking states are saved in a database table nad are encoded
differently.

> As a result the calendar still works perfectly, but the roll-over texts for month forward/backward and the 'Last update' text are reduced to an 'e'. In the
> grand scheme of things not of vital importance, but a niggling don't-know-why which I can't seem to solve. Any thoughts?

I suspect that it has something to do with the extract() function that
you are using.
As you willl have seen from the language files, they define a variable
called "$lang".
As you have passed the lang=en in the url, it looks like the $lang
array for all the texts is being overwritten with this value.

If this is the case you could either modify the arrow icons along with
their titles BEFORE you include the form code that you posted (ie
create a couple of variables like this:
$calendar_controls='
<div id="cal_prev" title="'.$lang["prev_X_months"].'">'.
$icons["previous"].'</div>
<div id="cal_prev1" title="'.$lang["prev_month"].'">'.
$icons["previous_1"].'</div>
<div id="cal_reset" title="'.$lang["cal_2_current"].'">'.
$icons["current"].'</div>
<div id="cal_next1" title="'.$lang["next_month"].'">'.
$icons["next_1"].'</div>
<div id="cal_next" title="'.$lang["next_X_months"].'">'.
$icons["next"].'</div>
';
..... your form code.....

Then in the calendar code where you had the bottons simply echo the
new variable that you have created like this:

<div id="cal_controls">'.$calendar_controls.'</div>


Alternatively you could modify your code to not use extract() (never
used it myself) and simply use the posted values directly ie:

if(isset($_POST["submit"])) {
$body = "\r\nLa Serenade Reservation:\r\n\r\n $_POST["Achternaam"]\r
\n ".
"$Voornaam\r\n $Email\r\n $Telefoon\r\n $Data\r\n $_POST["Wensen"]\r
\n";
mail( "i...@laserenade.eu", "La Serenade Reservation Form",
$_POST["body"], "Van: i...@laserenade.eu" );
mail( $Email, "La Serenade Reservation Form", $_POST["body"], "Van:
i...@laserenade.eu" );


$status = '<br><b><font color="red">Your reservation has been sent.
Many thanks!</font><br><br>';
}

Personally I would opt for this last option but it is up to you ;)
Chris


On 10 mar, 13:22, Brian Galliford <i...@briangalliford.com> wrote:
> Hi Chris,
>
> you're a genius!! I'm very grateful for your swift and clear reply.
>
> Changing the charset for the page certainly solves the problem, although it remains strange that the és and û in the calendar were displayed perfectly, but those coming from the booking state didn't. Enfin - problem solved.
>
> Also adding ?&lang= ... to the url does the job perfectly.
>
> Incidentally I was unable to delete Spanish via the 'legal' route in the language admin section, so had to manually delete the language file from the server and remove the database tables. Once they're completed, if you'd like to include the language files I've made as standard with the program (Dutch, German and French) - I'll be more than happy to send them to you.
>
> May I please bug you with one last question and then I think I can leave you in peace?
>

> Underneath your calendar I've added a reservation form, as you can see here:http://www.laserenade.eu/ls_resEN.php?〈=en


>
> I'm using the following script to send the form and return a 'Your reservation has been sent' message:
>
> <?php
>         extract($_REQUEST);
>
>         if(isset($submit)) {
>                 $body = "\r\nLa Serenade Reservation:\r\n\r\n $Achternaam\r\n ".
>                         "$Voornaam\r\n $Email\r\n $Telefoon\r\n $Data\r\n $Wensen\r\n";

>                 mail( "i...@laserenade.eu", "La Serenade Reservation Form", $body, "Van: i...@laserenade.eu" );
>                 mail( $Email, "La Serenade Reservation Form", $body, "Van: i...@laserenade.eu" );


>                 $status = '<br><b><font color="red">Your reservation has been sent. Many thanks!</font><br><br>';
>         }
> ?>
> <?=$status?>
>
> If these lines are placed after the calendar script before the form - eveything works fine, except that the Thankyou message is displayed too far down the page. So I moved the script up before the calendar script. As a result the calendar still works perfectly, but the roll-over texts for month forward/backward and the 'Last update' text are reduced to an 'e'. In the grand scheme of things not of vital importance, but a niggling don't-know-why which I can't seem to solve. Any thoughts?
>
> Once again - very many thanks for your assistance.
>
> Best wishes
>
> Brian
>
> Op 10 mrt 2010, om 12:47 heeft cbolson het volgende geschreven:
>
> >> ... However when I use 'fermé'

> >> for closed in the Booking States, the character é is displayed as 'é'


> >> in the resulting Legend table.
> > Hmmm, works fine in my version (just checked)
> > Have you checked what charset your page is using?
> > My version is using "utf-8":
> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>
> > As regards the language, appending &lang=nl to the url or hardgoing it
> > into the page that shows the calendar like this:
>
> > $_REQUEST["lang"]="nl";
>
> > should work (place this BEFORE you include the calendar file).
>
> > Note - This is one of the things that I need to simplify for the next
> > release version.
>
> > Chris
>
> > On 10 mar, 12:08, Brian <i...@briangalliford.com> wrote:
> >> Dear Chris,
>
> >> I'm sorry to bother you again, but I've come across a couple of small
> >> issues whilst adapting your fabulous script to my client's wishes.
>
> >> First a small problem:
> >> I've added extra language files for Dutch, French and German. Accents
> >> and umlauts come across fine when entered into the basic language
> >> translation section (ie for months, etc.). However when I use 'fermé'

> >> for closed in the Booking States, the character é is displayed as 'é'

Brian Galliford

unread,
Mar 10, 2010, 9:19:22 AM3/10/10
to ajax-availabi...@googlegroups.com
Many thanks for your proffered solutions Chris.

Unfortunately I haven't been able to get either solution to work - but I suspect that's more to do with my lack of know-how rather than your examples. 

I did indeed prefer your 2nd option, but first came up against a fault report concerning the double quote marks:

Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in ls_resEN.php on line 37

Having changed these to single quote marks, the fault report changed to:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ls_resEN.php on line 37

... and to this I don't know the solution.

I also tried your first suggestion, but wasn't too sure where to place the new variables - within their own <?php ?> tags and in the body just before my form code? The server couldn't process my attempt and the resulting page was completely askew.

This is now really going beyond the remit of your own fabulous Calender program and I think it's a bit cheeky to continue bothering you with it ... so I hope to be able to find a solution or a work around myself.

It doesn't take anything away from the fact that you've done a great piece of coding to create this module - and I'm very grateful for the help you've given in the installation and server specific issues which I've had.

Best wishes

Brian


cbolson

unread,
Mar 10, 2010, 10:00:42 AM3/10/10
to Ajax Availability Calendar
Sorry, there where a few mistakes in my code snippet...
Try this:

if(isset($_POST["submit"])) {
$body = "\r\nLa Serenade Reservation:\r\n\r\n ".
$_POST["Achternaam"]."\r\n".$_POST[["Voornaam"]."\r\n ".
$_POST["Email."]."\r\n".$_POST["Telefoon."]."\r\n ".$_POST["Data."]."\r
\n ".$_POST["Wensen"]."\r\n";

mail( "i...@laserenade.eu", "La Serenade Reservation Form", $body,
"Van: i...@laserenade.eu" );

mail( $_POST["Email"], "La Serenade Reservation Form",$body,


"Van:i...@laserenade.eu" );
$status = '<br><b><font color="red">Your reservation has been sent.
Many thanks!</font><br><br>';

}

Chris

Brian Galliford

unread,
Mar 10, 2010, 10:22:24 AM3/10/10
to ajax-availabi...@googlegroups.com
Aha ok thanks very much for this, but it also still has to be single quote marks between the [ ] brackets.

I've put this these corrections place, no more fault messages, but now the status line doesn't come up after sending as called by

<?=$status?>

placed just after this code and before the calendar code.

I'm also not sure whether the mail was sent, since I haven't received the confirmation email which normally arrived a couple minutes after sending.

Brian

cbolson

unread,
Mar 10, 2010, 10:57:28 AM3/10/10
to Ajax Availability Calendar
If you want you can send me your ftp details (via email) and I'll sort
this out for you in a couple of minutes :)
Chris

cbolson

unread,
Mar 10, 2010, 11:13:45 AM3/10/10
to Ajax Availability Calendar
> > <?=$status?>
By the way, that line is using "old" php syntax that is not now
supported in many servers.
The php "short tags" es being phased out.
That line should be:
<?php echo $status; ?>

Chris

Reply all
Reply to author
Forward
0 new messages