Page 1 of 2
wxcurecords.php
Posted: Sun 28 Aug 2011 11:14 pm
by n9mfk
hi All,
i get this error were a month should be
Notice: Undefined index: langMonths in C:\c_n9mfk\www\wxcurecords.php on line 217
I have not made any changes to wxcurecords.php
how can i fix this
thanks beau
http://99.148.159.206/wxcurecords.php
Re: wxcurecords.php
Posted: Sun 28 Aug 2011 11:45 pm
by beteljuice
Looks OK from here ?
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 12:19 am
by n9mfk
Hi beteljuice,
if you load the page then click reload it will brake
Beau
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 12:30 am
by saratogaWX
It appears that one of the functions is having a problem with your date/time format for all-time records:
<!-- CU_getAlltimeDate input inDate='at 3:37 PM on 21 July 2011' -->
<!-- CU_getAlltimeDate after tstr='$2 $1' -->
<!-- CU_getAlltimeDate result ltime='31 12 1969 18:00' -->
<!-- CU_getAlltimeDate input inDate='at 7:33 AM on 10 January 2010' -->
<!-- CU_getAlltimeDate after tstr='$2 $1' -->
<!-- CU_getAlltimeDate result ltime='31 12 1969 18:00' -->
The extra PM or AM was unanticipated.. I'll need to change the CU_getAlltimeDate function to fix that.
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 4:29 am
by saratogaWX
I think my prior post was somewhat in error .. the problem seems to be your PHP installation, Beau.
The code in CU_getAlltimeDate()
Code: Select all
if(preg_match('|^at (.*) on (.*)$|i',$inDate)) { // at 2:45 PM on 16 October 2009
$tstr = "$2 $1";
} elseif (preg_match('|^on (.*)$|i',$inDate)) { // on 16 October 2009
$tstr = "$1";
}
seems to fail in your PHP to set the temporary variables $1 and $2 with the results of the last preg_match (which works fine on my PHP).
You can change that code to
Code: Select all
if(preg_match('|^at (.*) on (.*)$|i',$inDate,$m)) { // at 2:45 PM on 16 October 2009
$tstr = $m[2] . " " .$m[1];
} elseif (preg_match('|^on (.*)$|i',$inDate,$m)) { // on 16 October 2009
$tstr = $m[1];
}
which uses the $m variable to store the matches. I'll change the code in the next release of the CU-defs.php version, but go ahead and try it on your copy.
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 12:57 pm
by n9mfk
Hi Ken,
i put in the new code im still get the Notice: Undefined index: langMonths in C:\c_n9mfk\www\wxcurecords.php on line 217 2009
Beau
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 6:50 pm
by saratogaWX
With the modified code, the CU_getAlltimeDate() routine is correctly parsing it with your PHP
Code: Select all
<!-- CU_getAlltimeDate input inDate='at 3:37 PM on 21 July 2011' -->
<!-- CU_getAlltimeDate after tstr='21 July 2011 3:37 PM' -->
<!-- CU_getAlltimeDate result ltime='21 7 2011 15:37' -->
<!-- CU_getAlltimeDate input inDate='at 7:33 AM on 10 January 2010' -->
<!-- CU_getAlltimeDate after tstr='10 January 2010 7:33 AM' -->
<!-- CU_getAlltimeDate result ltime='10 1 2010 07:33' -->
However, there's a problem in
<tr class="column-dark">
<td><?php langtrans('Highest'); ?> <?php langtrans('Monthly Rainfall'); ?></td>
<td><?php print $WX['rfallmH']; ?> <?php print $SITE['uomRain']; ?></td>
<td><?php print fix_CU_record_date($WX['TrfallmH']); ?></td>
</tr>
The fix_CU_record_date() function is showing
<tr class="column-dark">
<td>Highest Monthly Rainfall</td>
<td>8.78 in</td>
<td><!-- inDate='October 2009' month='October' year='2009' -->
Notice: Undefined index: langMonths in C:\c_n9mfk\www\wxcurecords.php on line 217
<!-- outTime=' 2009' -->
2009</td>
</tr>
so the month/year are processed correctly.
Your site seems to be missing the language-en.js file .. install that, and you should be rid of the Notice error.
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 7:44 pm
by n9mfk
Hi Ken,
I added the file what else did need to change im still get the error?
Beau
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 8:42 pm
by mike
I got the same problem as beau.
<tr class="column-dark">
<td>Highest Monthly Rainfall</td>
<td>7.35 in</td>
<td><!-- inDate='May 2011' month='May' year='2011' -->
<!-- outTime=' 2011' -->
2011</td>
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 8:57 pm
by saratogaWX
n9mfk wrote:Hi Ken,
I added the file what else did need to change im still get the error?
Beau
Beau, you added the file as language-en.js
.txt, it needs to be
language-en.js
That's why I'd put the comment with the download to "Save file as language-en.js".
mike wrote:I got the same problem as beau.
<tr class="column-dark">
<td>Highest Monthly Rainfall</td>
<td>7.35 in</td>
<td><!-- inDate='May 2011' month='May' year='2011' -->
<!-- outTime=' 2011' -->
2011</td>
What's the URL for your website, Mike?
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 9:13 pm
by saratogaWX
Ahh... found the underlying issue.. I'd forgotten to put a copy of the language-en.js into the Base-USA distribution .zip (now corrected).
So those users of Base-USA with Cumulus-Plugin will need to manually add the language-en.js file to fix the Notice error and correctly display the month for Hightest Rain in wxcurecords.php
Sorry for the inconvenience.
Best regards,
Ken
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 9:17 pm
by n9mfk
Hi ken,
I Changed the name of the file
im still get Undefined index: langMonths in C:\c_n9mfk\www\wxcurecords.php on line 217 2009
Beau
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 9:26 pm
by mike
Ahh... found the underlying issue.. I'd forgotten to put a copy of the language-en.js into the Base-USA distribution .zip (now corrected).
So those users of Base-USA with Cumulus-Plugin will need to manually add the language-en.js file to fix the Notice error and correctly display the month for Hightest Rain in wxcurecords.php
That fixed it for me.
Thanks
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 9:47 pm
by saratogaWX
Beau,
It looks like the language translation function is not engaging.
You seem to also be missing language-en.txt file.
Try installing that too (I've fixed that in the distribution).
Re: wxcurecords.php
Posted: Mon 29 Aug 2011 10:19 pm
by n9mfk
Hi Ken,
that fixed it
are there any other file missing
what are thy used for ?
thanks