Clevedon Weather

Personal Weather Station

Live Weather conditions from Clevedon, North Somerset, UK

Weather Display - Monthly All Time Records

This simple script is a version of one of the first scripts I produced although I do not currently use it myself on my site it was produced for a friend. It will display the graphics the Weather Display produces each month with the monthly records.

I wanted an easy way to display the same month from previous years to compare weather conditions between years.

This is a very simple script to setup and only requires three variable to be changed to suit your own web site. You need to set the first year you started collecting data with Weather Display and first month. This prevent the script trying to display graphics that are present. The final setting to the location on your directory with your Weather Display is stored.

Below is the script which could be cut and pasted into your own site and edited with your own setting. At the bottom of the page is a link to download a zip file of the script.

Without adjusting the settings the script should display my weather records.

When you load this script http://www.....matr-script.php it should display the current months all time records with thos years records first followed by every other years records you have.

To display other months records just add a parameter ?month=n to the end of the URL eg. http://www.....matr-script.php?month=4 to display April's records.

The script provided works but you will want to refine it for your own use. One simple refinement would be to add a series 12 links to navigate to each month of the year

To see the script in use is at Example of Script in use Weather

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Weather Display Monthly Records for selected month</title>
</head>

<body>

<p>Insert Your Page Header Before Here</p>

    
<?php

date_default_timezone_set
('Europe/Dublin');

// PHP script to display monthly weather display all time records. When page load it display the current month for this year
// the same month for all previous years in reverse order.
// To display other months record add ?month=1 to the URL to display Januarys records and ?month=12 to display Decembers etc.
// eg http://www.------------.co.uk/matr_script.php?month=4
//
// Copyright Ian Knox 2013 - Clevedon Weather
    
    
if (isset($_GET['month']))
        {    
        
$mon=$_GET['month'];
        }
    else
        {
        
$mon=date('n');
        }

$firstyear=2009// set to the first year of your records
$firstmonth=4;        // set to the first month of your records;
$thisyear=date('Y');
$wd_directory="http://www.clevedonweather.co.uk/wdisplay/"// set the file path to the location of your weather display files

if ($mon<$firstmonth) { // increase first year by one if month before first month
    
$firstyear++;
    }
    
if (
mktime(1,0,0,$mon,2,date("Y"))>time()) {  // decease this year by one if selected month after this month and 1 day and 1 hour
    
$thisyear--;
    }    

for (
$yr=$thisyear$yr>=$firstyear$yr--){
        echo 
'<p align="center">' .date("F Y"mktime(000$mon1$yr)) ."</p>";
        echo 
'<p align="center"><img src="'$wd_directory $mon $yr .'alltimerecordsmonth.gif" alt="Graphic"/></p><br/>';
    }    
?>

<p>&copy; Ian Knox - Clevedon Weather 2013</p>

<p>Insert Your Page Footer After Here</p>

</body>

</html>
The above script can be download Monthly All Time Records Script requires PHP5

Never base important decisions on this or any weather information obtained from the Internet.

Valid HTML 4.01 Transitional UK - WEATHER STATION TOPSITES - UK
Home | Weather Related Links | Detailed Weather Summary | Daily Reports | Live Weather Cam |
Weather Forecasts | Live Weather | About my Personal Weather Station | My Photos
Contact Webmaster
Last modified: October 10 2017 18:29:34.