Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See the Wiki for download

New Script that displays a selected daily statistic for every day

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

Moderators: daj, TNETWeather

User avatar
kocher
Posts: 67
Joined: Sat Apr 19, 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: New Script that displays a selected daily statistic for every day

Post by kocher » Sat May 12, 2018 6:13 pm

Thank you very much sfws

I just installed the new version of your script.

http://kocher.es/cumulusMX/dailypick_2_12.php

However, an error occurs:

"PHP Fatal error: Call to undefined function print_array() in H:\webspace\hostings\kocher.es\hosting\www\cumulusMX\dailypick_2_12.php on line 336"

The code of my file is:

http://kocher.es/cumulusMX/dailypick_2_12.php.txt
Image

sfws
Posts: 461
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: New Script that displays a selected daily statistic for every day

Post by sfws » Sat May 12, 2018 6:16 pm

rogerthn wrote:Many thanks sfws
Thank you. Well done for successfully using my script.
I hope you don't mind me suggesting that a consistent set of navigation links across all the pages on your site would improve it. You need to choose between the "standard Cumulus links" and your various styles of buttons that I assume are more recent additions. You could look at other sites for inspiration, or just copy one of your button styles onto all your pages.
With your two weather stations it would be nice if you had a page that showed numbers from both, then you could compare one against the other, but otherwise your site looks good.

sfws
Posts: 461
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: New Script that displays a selected daily statistic for every day

Post by sfws » Sat May 12, 2018 6:21 pm

kocher wrote:"PHP Fatal error: Call to undefined function print_array() in H:\webspace\hostings\kocher.es\hosting\www\cumulusMX\dailypick_2_12.php on line 336"
Ok, that is one of my many shared functions that appears in the script mentioned in the first include http://sandaysoft.com/forum/viewtopic.p ... 65#p126065. I use it instead of "print_r" for arrays, and I am sorry use of it caused you to see an error. As I said what you have now is actually basically an old script that I have not rewritten for sharing. But thanks for trying my daily summary script, the includes that I quote in my scripts list the common functions and variables they contain, so if you still have a problem after adding code below, let me know and I will dig out more.

Code: Select all

	
 #---------------------------------------------------------------------------------#
 #  The novel sub-function that follows is a more friendly way		
 #  of displaying the contents of an array for easy diagnosis.		
 #	 Intellectual Property of SPAWS -  last updated October 2017		
 #  The first input parameter is the actual array to be output.		
 #  The second input parameter is an optional string to describe the array.		
 #  (It can be the actual array name enclosed in single quotes).		
 #---------------------------------------------------------------------------------#
function print_array($array_input,$array_name = 'Array')
{
    if(!count($array_input)) echo '<br><span class="red"> '. $array_name . '( )</span> &nbsp; &nbsp;<span class="blue">is Empty</span>';
	else{
			echo '<br><span class="red"> '. $array_name . '( </span> &nbsp; &nbsp; ';
			foreach ($array_input as $key_input => $value_input)
			{				
				if (is_array($value_input)) {
						echo ' <span class="red">[' . $key_input . ']</span> &rarr; ';
						print_array($value_input,'Sub-array');
				} else {   
						echo " [$key_input]".' => ';
						echo ' <span class="blue">' . $array_input[$key_input] . '</span>,&nbsp; &nbsp; &nbsp; &nbsp; ';
				}
			}
			echo '<span class="red">);</span> &nbsp; &nbsp;';
	}
	echo '<br>';
} 
Last edited by sfws on Wed May 16, 2018 6:19 am, edited 1 time in total.

User avatar
rogerthn
Posts: 159
Joined: Thu Apr 11, 2013 6:31 pm
Weather Station: Oregon Scientific WMR88
Operating System: Raspbian GNU/Linux 8
Location: Trollhättan Sweden
Contact:

Re: New Script that displays a selected daily statistic for every day

Post by rogerthn » Sat May 12, 2018 7:24 pm

sfws wrote:Thank you. Well done for successfully using my script.
I hope you don't mind me suggesting that a consistent set of navigation links across all the pages on your site would improve it. You need to choose between the "standard Cumulus links" and your various styles of buttons that I assume are more recent additions. You could look at other sites for inspiration, or just copy one of your button styles onto all your pages.
With your two weather stations it would be nice if you had a page that showed numbers from both, then you could compare one against the other, but otherwise your site looks good.
I do NOT mind, improving my web-site has been on the to-do list for some years now :bash:
Regarding my two stations
The National Geographic 265 NE was in operation using Cumulus from 2008-10-12 until 2017-12-19 but is now dead.
The Oregon Scientific WMR88 was started on 2013-04-07 and is still running fine, I've replaced the rain gauge once.
Image

User avatar
kocher
Posts: 67
Joined: Sat Apr 19, 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: New Script that displays a selected daily statistic for every day

Post by kocher » Sat May 12, 2018 7:30 pm

Now it seems to work well, thank you very much :D

I will do tests with the css file to try to improve the vision of the data.

Saludos desde San sebastian
Image

sfws
Posts: 461
Joined: Fri Jul 27, 2012 11:29 am
Weather Station: Customised mix of Fine Offset
Operating System: Tempermental Win. 10 PC
Location: UK

Re: New Script that displays a selected daily statistic for every day

Post by sfws » Sat May 12, 2018 8:00 pm

rogerthn wrote:is now dead.
Oh, I had not picked that up.
rogerthn wrote:improving my web-site has been on the to-do list
Yes, my to do list is enormous. My amateur efforts with computer projects take up more time than I can really spare, but from time to time, my other planned activities have been disrupted by other people, in fact rather a lot recently, so with more time at home I have considered the PC more appealing than paperwork or housework!

----------------------
kocher wrote:Now it seems to work well, thank you very much
Thank you.
Good to hear, it has given me many years service, and certainly using PHP for daily summary makes for much simpler coding than the Alternative JavaScript predecessor script I was working on from 6 years ago to 4 years ago. Maybe I should have considered the PHP version for sharing before, but with Beteljuice, Mark Crossley, and BCJKiwi all contributing sophisticated versions of daily summary using PHP, I did not expect any interest in my amateur attempt at a simpler script.
Capture.PNG
As for CSS, looks are very personal, but I have been tinkering with CSS for many years, still not entirely satisfied. For this daily summary (see picture, although most of colours have been distorted between how they appear on my screen and how they appear in post, it shows the essential look), I have different background shades for Left Hand and Right Hand cells for each day, another for row and column labels, and of course default looks for many HTML tags.
You do not have the required permissions to view the files attached to this post.

Post Reply