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

AnnualDataSummary PHP

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

AnnualDataSummary PHP

Post by BCJKiwi »

Sorry to start another thread on this topic but have not found answers through searching and reading the existing threads.

Started from the download via the wiki and use the PHP version on the Saratoga Templates.
Have run this for a while and it works well.

Have added a number of additional tables - now have a total of 20 parameters.
The selection buttons are spread over 3 rows, wrap in the middle of the buttons and overlap vertically.

I have not been able to work out how to sort this and presume the unsorted list will need to be turned into a more sophisticated table arrangement but that is beyond me. As it is the PHP version, the tips for fixing this in the HTML/JS version appear not to apply.

There is another issue. The pages display OK (apart from the layout mentioned above) but the pages don't validate.
Most throw the same two errors:-
"Line 350, Column 36: there is no attribute "datarow"
<tr><th id="tr1">1</th><td datarow= " #tr1" datacol="#tc1" class="datacell"></td>…"

The min/max temp throws 368 errors.
I went back to the original and find that it also throws a few errors.

Would appreciate some pointers/help/fix suggestions and can post the script if required - else look on the site here http://www.silveracorn.co.nz/weather/wx ... ummary.php

Thanks
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: AnnualDataSummary PHP

Post by sfws »

List of parameters
I imagine, you could try adjusting the padding-top and padding-bottom in the CSS

Code: Select all

#table_menu li 
to stop the overlapping.

Code: Select all

 { $tablelayout .= '<li><a href="' . $_SERVER['PHP_SELF'] .'?year='.$tableYear .'&data=' . $label_items[$i][0] . '">' . $label_items[$i][1] . '</a></li>'; } 
Alternatively perhaps you could insert some blank lines <br> to separate the three lines of parameter navigation links by rewriting the PHP presumably the bit quoted above.
Sorry, my knowledge is not good enough to rewrite the above original php.

PHP errors
Look at another site using PHP Annual Daily Summary
e.g. http://www.janter.co.nz/weather/data/datasummary.php
or http://poundstockpacket.org.uk/weather/ ... hly_01.php
or http://www.altonaweather.ca/dayfile.php ... ta=minmaxt
or http://menstonweather.freeglo.net/datasummary.php

Viewing the source in any of these and comparing with yours, will show where your PHP has generated incorrect HTML and hence errors.
The td elements on these other PHP sites use the attribute id to identify row and column
not the datarow and datacol attributes your readDayfile.php uses. Sorry I do not know PHP to quote better code than the original that follows:

Code: Select all

var tcol=$(this).attr("datacol");
Last edited by sfws on Sun 11 Nov 2012 7:46 pm, edited 1 time in total.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Thanks for your reply.

Have looked at those sites and find that there seem to be signicant differences in the code structure for most of them so am not sure how well I will be able to relate them back to what I have.
Also, some of them appear to be using the HTML/JS templates not the PHP template. Edit - most likely the jQuery - see later posts BCJKiwi
There are a number of other differences as well which suggests they have either been largely re-written or have started from a different source.
Will study them in further detail and see if I can sort it out.

I thought I was doing something fairly simple - i.e. just adding further items in exactly the same way they were coded originally so do not really understand at this stage why the code behaves so differently from the original - well it doesn't behave all that differently in that the validation errors are there in the original as well!

I have tried adjusting the padding in the css but did not achieve the changes where needed.
I also tried inserting <br /> in the relevant places but this did not work. Also tried a number of other things without success, hence the post!
Last edited by BCJKiwi on Wed 14 Nov 2012 11:35 pm, edited 1 time in total.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

OK,
Have discovered there was a later version of the readDayfile.php (september 2011 instead of March 2011) which made the change from datarow datacol and also fixed the # error.

It also made a few other minor changes and sorted out the readability of the script changing the layout and adding some descriptive text - now why did I not have that one to begin with??! - well that would be because the . zip file in wiki/webtools contains the old one - do not recall how I came to have a later one - it was downloaded as a single file in a .zip - not part of a set as is in the Wiki - perhaps someone could update the wiki set to include the later file?

Have worked out exactly where to manage the rows at the top of the table - required breaking the ul into three separate uls . I had tried this before but after more study (via W3schoolls.com) I figured exactly which bits needed to be repeated in each code block.

So all is good now except the min/max temp still throws a lot of errors as it does with the unmodified script.
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: AnnualDataSummary PHP

Post by sfws »

Glad you've sorted out the PHP for single value per day parameters.
The parameter selection links look much better on your site now. (The CSS and <br /> options can be made to work, but multiple <ul> is easier).

Re those other sites - I thought I had only selected PHP ones. If jQuery/JavaScript version is being used there is this call in HTML:

Code: Select all

<script src="DIRECTORY/readDayfile.js" type="text/javascript"></script>
and the HTML has no table, just an element like:

Code: Select all

<div id="tableData">
<!-- This is place where the script inserts the required annual table of observations -->
    <noscript id="ns-text"><h4>! ECMA Script (aka JavaScript) needs to be Enabled in your browser to see a nicely formatted table here showing selected parameters for a year at a time. </h4>
</noscript>
</div>
If you choose to view source (right click on web page) you do not see what the jQuery code generates.

Conversely, if you view the HTML source for a PHP version, then you see what the PHP has generated. This means you see a table element with table row elements inside it and table data elements inside that containing the values.

Readability of script - see other postings on this forum (e.g. steel series). Basically, script can be compressed for quicker processing (comments and un-necessary spaces or new lines are removed) or laid out with spaces, tabs and other indents, plus comments for readability. It also depends which editor you are using to read the script and how you have set the tool up, they vary in where/how they insert newlines.
Last edited by sfws on Mon 19 Nov 2012 12:12 pm, edited 2 times in total.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Thanks for your comments.
May have been confused by the JS in the middle of the php scripts and the significant different layouts that those scripts use.

I added the "/" by replacing the "|". However this combines the two sets of data (min & max) into a single data cell as the | is the data split separator. This put all the data into the first column but the title is in the second column. The first column is normally the space between the data.
Have now managed to fix that with this solution;

Code: Select all

changed
$data[$id] = $buf_arr[$dayfilecol] .'|'. $buf_arr[$dayfilecol2]
to
$data[$id] = '|'. $buf_arr[$dayfilecol] .'/'. $buf_arr[$dayfilecol2]
which combines the data into a single value (/ insted of |) but puts the data into the second column by putting the | at the beginning making the first column empty.

So there are two things remaining to sort;
The double td which you have indicated and only occurs on the min/max Can see exactly where this is happening but don't see how to change it - needs somenone with a lot more expertise that I have.
The javascript for highlighting the day/month headers for the selected cell - this just does not work.
I think I will just ignore the highliting as I don't see great value in this feature as the column/row layout is pretty clear.
Both these issues are present in both the original March and September versions of the php script.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: AnnualDataSummary PHP

Post by beteljuice »

That uses googles jscript library <script src="https://ajax.googleapis.com/ajax/libs/j ... ery.min.js" type="text/javascript"></script> (or whatever the link / version is now)
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Thanks beteljuice,
Have added that to the conatiner php file (as there is no <head> in the readDatafile.php itself).

It now works.
There is a minor glitch resulting from the mod placing both minmaxt data columns in the second column described above. The mouse over highlight only works on the empty spacer column for minmax!
I did not understand exactly why that js link was required assuming it was only necessary for the HTML/JS version of the script, and, as JS support is provided by our hoster. I presume from this (and the reference to 'libs' in the link you provided that this link actually contains a library of routines that make this work.

Do you have any thoughts as to how one might remove the nested <td></td> inherent in daj's scripts? i have tried everything I can imagine might work without success.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: AnnualDataSummary PHP

Post by beteljuice »

As far as I can see it's only in the modified min / max temp table ?

There a few problems, in any one 'pair' of cells only one is being given an id, and the closure of the <td> 'pair' is out of sequence.

Code: Select all

<td id="tr1-tc1" class="datacell"><td class="datacell smallfont"></td></td>
should be:

Code: Select all

<td id="tr1-tc1" class="datacell"></td><td class="datacell smallfont"></td>
However: this still means a redundant cell has been created (because you want both values in one cell). The highlight 'problem' seems to be associated with the id, because the code couldn't cope with two cells highlighting the 'month' cell.

I would suggest finding the min / max part that creates two cells and make it like the other tables (single cell) but still with smallfont and your combined data.
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Yes the issue is with the minmax only.
If you skim the posts above you will see there is an issue with the original script(s) from DAJ with the minmax not being html compliant and as identified by beteljuice there is a nested <td>. So yes it is the min/max only, but it is not a result of the mods I have made - both fields are still there, an empty one and one with data.
Both the highlighting anomaly and the validation errors arise with the original script and the current script.

Have attached the relevant section of the code. The problem arises as the calendar is built within a for loop. There are additional table data definitions to reduce the font size for the minmax and these are nested inside the main table data.
I have not been able to work out a way to resolve this within the existing general structure.
You do not have the required permissions to view the files attached to this post.
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: AnnualDataSummary PHP

Post by sfws »

Double td open is simple to solve,
move the extra </td> (as per attached) to before the extra <td>.
If you want both values in single column, just take out the references to <td> or </td> in every

Code: Select all

 if ($dayfilecol2 >0) {
that refers to second value.
readDayfilepart.zip
My earlier posting deliberately mentioned jQuery rather than JavaScript, sorry for not explaining it needed to be loaded for converting to javascript that browser can process in real time.

Once everything is okay, you might want to post your corrected php file, for others to use. However, the replacement version for the wiki would have to be amended to just have the basic parameters and no extra value colouring.
You do not have the required permissions to view the files attached to this post.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: AnnualDataSummary PHP

Post by beteljuice »

Still not quite right.
The initial cell of a min/max pair would not be small font (the existing commented line would need to be uncommented)

In terms of the single cell mod, two cells would still be generated,

In both cases only the first cell of the pair obeys the mouseover highlight (I can't see a quick fix for that)

I will ponder upon it ..... :geek:
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Thanks again for your help.

I have made the change as per your attached file. It reduced the validation errors from 360+ down to 21, a major improvement! The remaining errors relate to an issue with the 'nondate' portion.

I see now what you mean re jQuery not Javascript - my error, I should have noticed they were different things earlier.

I don't follow what you mean in relation to the both values in a single column. They are already in a single column. Removing any of the <td> </td> relating to the dayfilecol2>0 completely destroys the layout of the entire calendar.

It was my intention to post the working script once it was error free. However I have no idea what the correct procedure is to get the wiki updated (there are also some tweaks to the .css). I am sure it should be checked over by someone such as yourself who has a proper understanding of the code rather than a tinkerer such as myself who is still desparately trying to find my way around the code.

I am not sure which 'colouring' you refer to;
the jQuery (in the original september 2011 script),
the extra data types added to the original script for 0 values,
the high value (also in the original)
or maybe some of the colour choices I tweaked slightly in the css?
I hate to think of the number of hours I have spent on this so far but it is all a big learning curve for me.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: AnnualDataSummary PHP

Post by BCJKiwi »

Cross post.

Re the mouseover.
In the single value calendars, there are still two columns, the first is the space and the second the data but the colspan=2 presumably makes them work as a single column and the highligt is across both columns.

In the original script, the min is in the first column and the max in the second with a space between. This makes it hard to read. Hence the idea of combining the data into a single cell with the / between - makes it much clearer to read. However when I first did this the data ended up in the first column and was out of line with the labels at the top. Hence the | to ensure the data was in the second column. I guess the other way to handle this would be to combine the min & max together much earlier in the process before the calendars are written so filling the columns would be the same for all data except for the font size.
I considered this some time ago but could not see how to achieve it.

Thanks again
Last edited by BCJKiwi on Tue 13 Nov 2012 7:23 pm, edited 1 time in total.
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: AnnualDataSummary PHP

Post by sfws »

BCJKiwi wrote:I am not sure which 'colouring' you refer to;
the jQuery (in the original september 2011 script),
the extra data types added to the original script for 0 values,
the high value (also in the original)
or maybe some of the colour choices I tweaked slightly in the css?
I meant the last - any colouring not in original.
BCJKiwi wrote:I don't follow what you mean in relation to the both values in a single column. They are already in a single column.
BCJKiwi wrote:In the original script, the min is in the first column and the max in the second with a space between. This makes it hard to read. Hence the idea of combining the data into a single cell with the / between - makes it much clearer to read.
Sorry if I was unclear, I was posting in a hurry before going out for the day here. Let me spell it out step by step:
1 - If you were having the min in first column and max in the second, then separate
sfws wrote:td element

Code: Select all

<td>...</td>
are needed to generate the two columns.
2 - If you
sfws wrote:take out the references to <td> or </td> in every

Code: Select all

if ($dayfilecol2 >0) {
that leaves you with a single

Code: Select all

<td>...</td>
to contain both values.
3 - The attachment here contains the necessary changes and a few extra comments. I do not have ability to test PHP, but I am reasonably confident that I made changes in right places - I might just have mistyped somewhere.
Revised_readDayfile_part.zip
BCJKiwi wrote:Thanks again for your help.
I have made the change as per your attached file. It reduced the validation errors from 360+ down to 21, a major improvement! The remaining errors relate to an issue with the 'nondate' portion.
Those 21 actually relate to colspan="2", so implementing my revised code should eliminate those errors.
You do not have the required permissions to view the files attached to this post.
Last edited by sfws on Mon 19 Nov 2012 12:08 pm, edited 2 times in total.
Post Reply