Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Comparing with one year ago

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

I am pleased to see that you now have the test page almost working in that figures appear in all parts of the table although you are showing figures relating to a different month depending on what the time is when anybody loads the web page, whilst you should be showing statistics for 3 October 2018 and 3 October 2017.

The problem was previously it was looking for a date in 2020! Your field delimiter and date delimiter suggestion was irrelevant as although I don't use MX, I believe Cumulus 1 and Cumulus 3 (MX) use same format for dates in dayfile.txt (although dates in other Cumulus log files are different between the two versions). You (dazza123) have solved that year problem, as presumably you were previously feeding in the first two figures of the year as the last two digits, now you are feeding in the correct 4 digit year. Perhaps, for the benefit of others, you can share what you had wrong and have now corrected, because I can't read your mind to know how you corrected the year.
Mapantz wrote:Anything to do with Cumulus V1 vs Cumulus V3?
Mapantz has spotted (well done) why that you still have a problem with the dates, as my Cumulus template file line 188 contains

Code: Select all

<script>var metDate=['<#metdate format="dd">','<#metdate format="mm">','<#metdate format="yyyy">',(parseInt("0"+"<#rollovertime>",10)),"<#rollovertime>"];</script><!-- Pass current Meteorological date and rollover time to script to search dayfile.txt, so knows what day to start search from --> 
so it is using web tag <#metdate> and using format parameters that work in Cumulus 1, but not Cumulus MX, for generating the HTML file that was designed (in 2012) for the default format in Cumulus 1. In Cumulus MX '<#metdate format="mm">' returns minutes (which do vary depending on when during the day you generate the web page), in Cumulus 1 it returns month number.

The solution is simple, the month format selector in template line 188 needs to be in capitals to work with both Cumulus 1 and Cumulus MX:

Code: Select all

<script>var metDate=['<#metdate format="dd">','<#metdate format="MM">','<#metdate format="yyyy">',(parseInt("0"+"<#rollovertime>",10)),"<#rollovertime>"];</script><!-- Pass current Meteorological date and rollover time to script to search dayfile.txt, so knows what day to start search from -->]
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

hey sfws thank for that and what i did was thay was a bug in the day file that the js was not understanding and jucking out any this it was so i recreated the the day file and bingo all working mate thanks


buti just need to sort Temperature Range / Dominant Direction /Wind Run out as it not showing up ?
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

dazza1223 wrote:just need to sort Temperature Range / Dominant Direction /Wind Run out as it not showing up ?
It would need me to do a lot of studying to check how the script does these calculations, because on my own test (not online) site I have totally revised how I calculate these.
For temperature range, the script should be subtracting the figure it displays for low temperature from the figure it displays for high temperature, therefore the calculation (and therefore the output) should occur immediently after it has found the second of those two from the various fields in the dayfile.txt line for one year ago.
The dominant direction uses a beteljuice routine to convert the bearing stored in field 39 (where date is field 0) into a compass direction. So the number should be passed to his function and the function will return a string that my script will output immediently afterwards.
The wind run appears in your screen shot, so are you suggesting the wrong figure is shown? Some days are far more windy than others, my figures vary between 0 and about 320 but I am sure my station does not capture fully actual speeds on windy days.
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

hey i was just to about to post to say ive fixed it now i was missing a tag in the js file thank u so much sfws :D :D :lol: :lol:
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Comparing with one year ago

Post by Mapantz »

As it's a wet & windy day, I decided to do some website stuff and thought i'd add the MySQL version of this to my site.

I've got 99.99% of it working - added a few extra's too. However, that 0.01% is the Beaufort number/description not showing up.

I get this error:

Code: Select all

PHP Notice:  Undefined variable: beaufort in /home/wareham1/public_html/yesterday_lastYear.php on line 63
https://warehamwx.co.uk/tod_yes.htm
https://warehamwx.co.uk/yesterday_lastYear.txt
Last edited by Mapantz on Fri 19 Oct 2018 6:58 pm, edited 1 time in total.
Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

where did u get the MySQL version from as i was looking for it
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Comparing with one year ago

Post by Mapantz »

The download link is in the same post with all of the other download links on page 1.
Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

o ok thank you did u here about this maybe shuting down in 4 day?
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

Mapantz wrote: However, that 0.01% is the Beaufort number/description not showing up.

I get this error:

Code: Select all
PHP Notice: Undefined variable: beaufort in /home/wareham1/public_html/yesterday_lastYear.php on line 63
Line 329 has error in second parameter of call, you have:

Code: Select all

'<span class="lowerfont">&nbsp;mph</span>&nbsp;'
It is supposed to be passing a parameter to a function, not defining a font
Replace that section of the line with 'mph', as the only allowed values for that second parameter are as given in line 38

Code: Select all

$unitChoice=['km/h','mph','kts','m/s'];

======================
dazza1223 wrote:where did u get the MySQL version from as i was looking for it
Mapantz wrote:The download link is in the same post with all of the other download links on page 1.
I told you that ...
sfws wrote:If you want to use PHP and MySQL, 'yesterday_lastYearT.php' includes everything (just beware column names, as I did not follow DAJ's originals (loosely based on the dayfile.txt), but invented a more rule based naming standard, as mentioned in some of my postings earlier this year). Anyway 35 downloads suggests that several people took an interest. I cannot promise that script works with latest PHP version and latest MySQL, it worked well with versions available in 2012.
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Comparing with one year ago

Post by Mapantz »

sfws wrote: Line 329 has error in second parameter of call, you have:

Code: Select all

'<span class="lowerfont">&nbsp;mph</span>&nbsp;'
It is supposed to be passing a parameter to a function, not defining a font
Replace that section of the line with 'mph', as the only allowed values for that second parameter are as given in line 38

Code: Select all

$unitChoice=['km/h','mph','kts','m/s'];
Doh! :oops:

Thanks sfws!

Thank you for sharing the script too. :)
Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

Mapantz wrote: Thanks sfws!

Thank you for sharing the script too.
Thank you for using it, your web page has a very neat look.
I am pleased implementing a 6 year old script apparently did not involve too much effort from you. If the forum does manage to stay up after Monday, seeing my script being used by you might make others want to use it too.
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

am i being dum or just look at the sceen to long!!!

but ive add the php version off Comparing with one year ago but i have different colour off the table row but i cant seem to get it the right away long the table as becoz off the php in the table ive tried all different ways :bash: :bash: :bash: but i cant sorry for being a :groan:


http://www.davisworthing.co.uk/new/tod_yes_yerar.php#
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

Simple, look at your HTML code your PHP script produces.

Code: Select all

 <tr class="table_two">
   <td class="table_two">Low&nbsp;Temperature</td>
   <td class="table_two">8.2&nbsp;&#176;C</td>
   <td class="table_two">at&nbsp;07:04</td>
   <td class="table_two">9.8&nbsp;&#176;C</td>
   <td class="table_two">at&nbsp;23:57</td>
   <td>12.4&nbsp;&#176;C
   <td>at&nbsp;05:10
   </tr>
You have a class for the first 4 table cells in each row, no class within the table cell opening tag and no closing </td> tag for the extra table cells. Give all table cells the same class and they will all look same.

I have found an easier way to code that I was not aware of when I produced that script. It is to write all the structure in HTML (i.e. just like the web pages Steve provides) and just use PHP echo shorthand (<?=) to put in any variables read from database (similar to how Steve includes his web tags), for example if the array $required_fields holds the database row for the day a year ago:

Code: Select all

 <td class= 'table_two'><?= $required_fields['MinTemp']; ?> &nbsp;&#176;C</td>
Whilst I have not bothered to rewrite old scripts that way, using that on new scripts has made it easier for me to spot whether I am being consistent with my HTML tag opening and closing!
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Comparing with one year ago

Post by dazza1223 »

ok thank u... and i have trid give them that and it all got rong

may be you can give me a demo off how to lay it out plzz

<td>
<?php
echo "$required_fields[4]";?>
&nbsp;<#tempunit>
<td>at&nbsp;
<?php
echo $required_fields[5];?>
</tr>
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Comparing with one year ago

Post by sfws »

To repeat my previous answer explicitly, so you can copy and paste:

You currently have missed out the class in the opening tag "<td>" and you have also missed out the closing tag "</td>" for the two extra table cells you have added to the end of the table row.

Code: Select all

<td>
<?php
echo "$required_fields[4]";?>
&nbsp;<#tempunit>
<td>at&nbsp;
<?php
echo $required_fields[5];?>
</tr>
So change your code by adding the class to the opening tag and adding the closing tag. You can either continue using full echo syntax

Code: Select all

<td class="table_two"><?php echo "$required_fields[4]";?>
&nbsp;<#tempunit></td>
<td class="table_two">at&nbsp;
<?php
echo $required_fields[5];
?>
</td>
</tr>
Alternatively you can still change your code by adding the class to the opening tag and adding the closing tag, but this time also replacing the "<?php echo" by using echo shorthand syntax "<?=" and this therefore simplifies the instructions to

Code: Select all

<td class="table_two"><?=$required_fields[4];?>&nbsp;<#tempunit></td>
<td class="table_two">at&nbsp;<?=$required_fields[5];?></td>
</tr>

I suggest you read a simple book such as "HTML5 in easy steps" or look at an online tutorial like "https://www.w3schools.com/html/default.asp", these have examples which help you understand how the look of a table cell (or any other HTML element) can be specified by reference to a class, and how the content specified in HTML is enclosed by opening and closing tags.

When you do understand HTML enough to get that right, then you can progress on to successfully including PHP script which is potentially much more complex. Again there are plenty of resources available online, or books to read, both allowing you to play with examples, but there have been some considerable changes in a few areas of the syntax between some older and newer PHP versions, and exactly what syntax is available can vary to some extent between servers, so the potential for complexity is huge if you go beyond the simple echo examples I include above.
Post Reply