Daily Summary: Difference between revisions

2,055 bytes added ,  19:03, 1 October 2018
m
→‎Some example Scripts: rewrite of section dealing with graphs, and clarification of dangers with adopting scripts by other people
m (→‎PHP scripts: added that coloured script was by Mark Crossley)
m (→‎Some example Scripts: rewrite of section dealing with graphs, and clarification of dangers with adopting scripts by other people)
Line 233: Line 233:


=== Some example Scripts ===
=== Some example Scripts ===
As for the [[#PHP_scripts|PHP daily summary scripts section]] - ''Be aware if you use PHP scripts written by someone else .... These scripts may use "include ..." or "require ..." to bring in variables (such as those for accessing the database) or functions (to do standard actions) or templates (shared headers, navigation menus and footers) or text (any other common content) that is used with a number of pages on author's site. If you don't comment out those references to external scripts, or replace the references with your equivalents, the PHP parser may fail to produce a HTML page and nothing will be available to the browser. Thus you do need a simple understanding of PHP, a PHP book, or the ability to look up PHP instructions on the web if you are to be successful with tailoring these scripts to your site.''
As for the [[#PHP_scripts|PHP daily summary scripts section]] - '''Be aware if you use PHP scripts written by someone else''' .... ''These scripts may use "include ..." or "require ..." to bring in further scripts that introduce variables (such as those for accessing the database) or functions (to do standard actions) or templates (shared headers, navigation menus and footers) or text (any other common content) that is used with a number of pages on author's site. If you don't comment out those references to external scripts, or replace the references with your equivalents, the PHP parser may fail to produce a HTML page and nothing will be available to the browser. Thus you do need a simple understanding of PHP, a PHP book, or the ability to look up PHP instructions on the web if you are to be successful with tailoring these scripts to your site.''
 
If the script you decide to use accesses a database, be aware that not everyone has the same approach to missing data. Some will only work with perfect data, some treat zeroes as missing data, others expect missing data to have "Null" in the relevant column. Also, although David Jamieson invented a schema, and that is the default used by Cumulus MX; it is possible to use a different schema and that means the column names might be different between how you have set up your database and what is used by a particular script. As I often say, you do really need to develop some understanding of PHP and database access instructions to sucessfully get most of the PHP scripts database using scripts working.  If you are new and inexperienced, using HTML, and JavaScript may be best for you.


Look in the Website Development section of the Cumulus support forum - '''Web general''' sub forum:
Look in the Website Development section of the Cumulus support forum - '''Web general''' sub forum:
Line 239: Line 241:
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=10755#p87081 Top 10 Records Page]- This script by Mark Crossley runs several queries against the daily summary table of a database and picks various extremes displaying the top ten extremes (e.g. ).  The latest source php can be seen using a [https://weather.wilmslowastro.com/test/top10s/top10sContent.php?view=sce query-string on Mark Crossley's web site] and there have been several updates since the forum thread was created.
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=10755#p87081 Top 10 Records Page]- This script by Mark Crossley runs several queries against the daily summary table of a database and picks various extremes displaying the top ten extremes (e.g. ).  The latest source php can be seen using a [https://weather.wilmslowastro.com/test/top10s/top10sContent.php?view=sce query-string on Mark Crossley's web site] and there have been several updates since the forum thread was created.
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=16534#p126964 What to do with data from MySQL] - This posting lists a number of web pages on PaulMy's web site where he presents statistics from the daily summary table of his database in different formats.
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=16534#p126964 What to do with data from MySQL] - This posting lists a number of web pages on PaulMy's web site where he presents statistics from the daily summary table of his database in different formats.
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=7834#p66013 This day last year page] - This post has a query in a php file (as you save the download change '.txt' to '.php') that will extract from the daily summary table in a database, values for one year ago, two years ago to feed a web page that displays all the summary statistics for today and the corresponding ones for earlier years.
**[http://sandaysoft.com/forum/viewtopic.php?f=14&t=7834#p66013 Comparing with one year ago] - This post has a query in a php file (as you save the download change '.txt' to '.php') that will extract from the daily summary table in a database, values for one year ago, to display alongside for example statistics for yesterday. An equivalent script using jQuery to read dayfile.txt directly is available for those who don't have a database. If you have some programming skills, you can vary either of these scripts to for example display statistics for each day in the last week (or month). I have written scripts that display the statistics for last week using a combination of this daily table in database approach and Cumulus recent tags. I have another script that uses the daily table in the databse to calculate the equivalent of what Cumulus 1 shows in View menu, this month selection, for any past month and adds the equivalent of what Cumulus this month web tags show and the resulting statistics are shown for various selectable mixtures of past months.


There are various scripts out there that output graphs from the values read, I have not identified a particular one to reference here yet.  If you find a site dislaying a graph you would like to copy on your own site, you might be able to see the PHP source that is responsible, but as I have commented [http://sandaysoft.com/forum/viewtopic.php?f=14&t=16425&p=126065#p126065 elsewhere] most authors do not make it easy to see their code.  Of course one of the reasons for using PHP script is that processing is done quickly on the web server and only the resulting HTML is passed onto the client browser and this does protect interlectual property and adds security by not showing the database access code.
There are '''various scripts out there that output graphs''' from the values in recent history web tags, or values read off either a daily table in a database or dayfile.txt directly. There are two to highlight here:
* An alternative to the Cumulus 1 or Cumulus MX trend web page is described in [http://sandaysoft.com/forum/viewtopic.php?f=18&t=12321 this topic] this can use all the sources mentioned.
* Highcharts (that cannot be used on a business web site) are exploited by Mark Crossley in [http://sandaysoft.com/forum/viewtopic.php?f=18&t=8672 this topic]; it is a very long topic, and discusses various issues to consider with using such data, as well as including the script.  
   
If you find a site displaying a graph or table you would like to copy on your own site, you might be able to see the PHP source that is responsible, but as I have commented [http://sandaysoft.com/forum/viewtopic.php?f=14&t=16425&p=126065#p126065 elsewhere] most authors do not make it easy to see their code.  Of course one of the reasons for using PHP script is that processing is done quickly on the web server and only the resulting HTML is passed onto the client browser and this does protect interlectual property and adds security by not showing the database access code.


=== Other jQuery approaches ===
=== Other jQuery approaches ===
5,838

edits