Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

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

PHP Web 'viewer' for Cumulus NOAA Style reports

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

Moderators: daj, TNETWeather

RayProudfoot
Posts: 2471
Joined: Wed May 06, 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby RayProudfoot » Tue Dec 13, 2011 11:22 pm

It's all a bit beyond me I'm afraid. Hopefully beteljuice will be along to help out. :)
Cheers,
Ray, Cheshire.

Image

User avatar
beteljuice
Posts: 2465
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby beteljuice » Tue Dec 13, 2011 11:55 pm

I've had one other person report this problem.

It seems to be a permissions thing where the directory won't allow the noaarep.css file to be written.

Copy this lot as noaarep.css and upload it to your site.

Code: Select all

/* default stylesheet for NOAA Style Reports ala beteljuice */
/* overall container */
.noaa_rep_container {
    font-family: courier new, courier, monospace;
    width: 635px;
    margin: 0 auto;
}

.noaa_rep_container a, .noaa_rep_container a:link, .noaa_rep_container a:visited, .noaa_rep_container a:hover, .noaa_rep_container a:active {
    color: #000000;
    text-decoration: none;
    background-color: white;
}


/* container for nav buttons */
.noaa_rep_nav_container {
    font-family: lucida console, courier new, courier, monospace;
    font-size: 8pt;
    font-weight: bold;
    text-align: left;
    line-height: 2.2;
    text-align: center;
}


/* the nav buttons themselves */
.noaa_rep_nav {
    text-align: left;
    border: 1px solid #000000;
    border-radius: 10px 10px 10px 10px; /* NOT IE8 and below */
    padding: 2px 5px 2px 5px;
    color: #808080;   
    background-color: #DDDDDD;
    font-weight: bold;
}

/* modified year button when used with expand - collapse (same as above but 'flattened' left-hand side) */
.noaa_rep_nav_alt {
    text-align: left;
    border: 1px solid #000000;
    border-radius: 0px 10px 10px 0px; /* NOT IE8 and below */
    padding: 2px 5px 2px 5px;
    color: #808080;
    background-color: #DDDDDD;
    font-weight: bold;
}

/* expand - collapse button (single line) */
.noaa_expand {
    color: #000000;
    border-radius: 10px 0px 0px 10px; /* NOT IE8 and below */
    background-color: #DDC81D; /* dirty yellow */
    cursor: pointer;
}

/* expand - collapse button (full menu) */
.noaa_expand_alt {
    color: #808080;
    border-radius: 10px 10px 10px 10px; /* NOT IE8 and below */
    background-color: #DDC81D; /* dirty yellow */
    cursor: pointer;
    visibility: hidden;
}

/* nav button hover color - NOT IE8 and below */
a.noaa_rep_nav:hover {
    box-shadow: 0 0 7px #007EBF;
}

/* nav button hover color - NOT IE8 and below */
a.noaa_rep_nav_alt:hover {
    box-shadow: 0 0 7px #007EBF;
}

/* highlight selected year or month button - NOT IE8 and below */
.noaa_selected {
    box-shadow: 0 0 7px #FF0000; /* red */
}

/* highlight selected year line */
.noaa_selected_line {
    background-color: #FFFF00; /* yellow */
}


/* container for the actual report file */
.noaa_rep_container pre {
    color: #000000;
    font-family: monospace;
    font-size: 9pt;
    font-weight: normal;
    text-align: left;
    border: 1px solid #000000;
    border-radius: 10px 10px 10px 10px; /* NOT IE8 and below */
    padding: 20px 0px 25px 20px;
    background-color: #f9f8EB;
}
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
dane
Posts: 410
Joined: Wed Sep 10, 2008 2:15 pm
Weather Station: Rosenborg 68700
Operating System: Win10 Ult., 64-bit, RaspberryPi
Location: Gilleleje, Denmark

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby dane » Wed Dec 14, 2011 12:11 am

Thanks beteljuice.
Your noaarep.css did the trick.
(Suggest you include it in your package - alternatively write a note telling other persons about the problem)
Ib

User avatar
beteljuice
Posts: 2465
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby beteljuice » Wed Dec 14, 2011 12:56 am

It is actually within the script ;) - but for some set ups won't come out to play :lol:

As for the note ........

........ we just wrote it :clap:
Image
......................Imagine, what you will KNOW tomorrow !

RobertY
Posts: 61
Joined: Fri Dec 09, 2011 5:16 pm
Weather Station: LaCrosse 2315
Operating System: Windows XP SP3
Location: East TN, USA
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby RobertY » Wed Jan 11, 2012 5:26 pm

Thank You. That copy did it for me to. Now I can link to them. :)

One question though. Is there one where all years and months show without having the drop down option to click on? I mean go to the php page and there is everything laid out?

RobertY
Posts: 61
Joined: Fri Dec 09, 2011 5:16 pm
Weather Station: LaCrosse 2315
Operating System: Windows XP SP3
Location: East TN, USA
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby RobertY » Wed Jan 11, 2012 5:32 pm

Nevermind, I found out how to do it. It is an option in the php file of simply changing a false to a true. :)

Trainman
Posts: 25
Joined: Fri May 21, 2010 5:47 pm
Weather Station: Davis VP2
Operating System: Windows 7
Location: Kvistgård Danmark
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby Trainman » Sun Jan 29, 2012 1:54 pm

I get this error report from my server: Warning: putenv() [function.putenv]: Safe Mode warning: Cannot set environment variable 'TZ' - it's not in the allowed list in /home/virtual/kvistgaardvejr.dk/public_html/NOAA-reports.php on line 160. If I comment out line 160 the report disappears and it seems that it´s working allright.

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby gemini06720 » Sun Jan 29, 2012 8:47 pm

Kenneth, in the PHP script 'NOAA-reports.php', have you entered the appropriate time zone information into the variable '$ourTZ' (line 24)?

Line 160 should have been written differently to make it compatible with both PHP4 and PHP5 - as used in many of Ken True's PHP scripts:

Code: Select all

# Set timezone in PHP5/PHP4 manner
if (!function_exists('date_default_timezone_set')) {
  putenv("TZ=$ourTZ");
} else {
  date_default_timezone_set("$ourTZ");
}
There is also the possibility that you hosting server does not allow you to change the setting of the default time zone... :(

User avatar
beteljuice
Posts: 2465
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby beteljuice » Mon Jan 30, 2012 12:23 am

From earlier in the thread:
mcrossley wrote:Oh, and the putenv error? I run in Safe Mode, so
In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied by this directive. By default, users will only be able to set environment variables that begin with PHP_
http://php.net/manual/en/function.putenv.php
The time / date correction is not actually used by Cumulus so it is 'safe' to comment it out. ;)

Code: Select all

$PHP_SELF = $_SERVER['PHP_SELF'];
// putenv("TZ=$ourTZ");
$now = getdate();
Image
......................Imagine, what you will KNOW tomorrow !

Trainman
Posts: 25
Joined: Fri May 21, 2010 5:47 pm
Weather Station: Davis VP2
Operating System: Windows 7
Location: Kvistgård Danmark
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby Trainman » Mon Jan 30, 2012 6:30 pm

gemini06720 wrote:Kenneth, in the PHP script 'NOAA-reports.php', have you entered the appropriate time zone information into the variable '$ourTZ' (line 24)?


Yes: 'Europe/Copenhagen', as mentioned in http://php.net/manual/en/timezones.php. Does this mean that the NOAA reports are generated t. minus 1 hour, due to the fact that i live in UTC + 1 timezone?
gemini06720 wrote:Line 160 should have been written differently to make it compatible with both PHP4 and PHP5 - as used in many of Ken True's PHP scripts:

Code: Select all

# Set timezone in PHP5/PHP4 manner
if (!function_exists('date_default_timezone_set')) {
  putenv("TZ=$ourTZ");
} else {
  date_default_timezone_set("$ourTZ");
}


Ray: do you mean that by changing line 160 to the code above it should work?
gemini06720 wrote:There is also the possibility that you hosting server does not allow you to change the setting of the default time zone... :(


Sad but true :(

oklaslim
Posts: 6
Joined: Sun Jan 15, 2012 10:27 pm
Weather Station: WA1080PC
Operating System: Windows XP SP3
Location: Oklahoma USA
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby oklaslim » Sat Feb 04, 2012 10:25 pm

I have downloaded the file and made these changes:

if ($Naming == 'WL') {
$NOAAdir = 'http://littlerockfreewillbaptistchurch.com/Weather/noaa/'; // point to your NOAA file sub-directry
$ThisYearFile = "http://littlerockfreewillbaptistchurch.com/Weather/noaa/NOAAYR2012.txt"; // point to your current NOAA yearly file
$ThisMonthFile= "http://littlerockfreewillbaptistchurch.com/Weather/noaa/NOAAMO0212.txt"; // point to your current NOAA monthly file
// $LastYearFile = "http://littlerockfreewillbaptistchurch.com/Weather/noaa/NOAAPRYR.txt"; // point to your prior NOAA yearly file
$LastMonthFile= "http://littlerockfreewillbaptistchurch.com/Weather/noaa/NOAAMO0112.txt"; // point to your prior NOAA monthly file
}
if ($Naming == 'VWS') {
$NOAAdir = 'http://littlerockfreewillbaptistchurch.com/Weather/noaa/'; // point to your NOAA file sub-directry
$ThisYearFile = "$NOAAdir/NOAAYR2012.txt"; // point to your current NOAA yearly file
$ThisMonthFile= "$NOAAdir/NOAAMO0212.txt"; // point to your current NOAA monthly file
}
if ($Naming == 'CU') {
$NOAAdir = 'http://littlerockfreewillbaptistchurch.com/Weather/noaa/'; // point to your NOAA file sub-directry

I get he page header NOAA-Style Reports but that is all I get.........can you tell me what I am doing wrong? I commented out the Pryor year as I do not have any yet.

Thanks
Slim
Woodland Junction East of Locust Grove, Oklahoma USA
http://littlerockfreewillbaptistchurch.com/Weather/index.htm

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby gemini06720 » Sat Feb 04, 2012 10:38 pm

Slim, you might want to change the following link from:

Code: Select all

http://littlerockfreewillbaptistchurch.com/Weather/noaa/
to

Code: Select all

./noaa
-- the code is not designed to read the data from a URL but from a local directory. ;)

oklaslim
Posts: 6
Joined: Sun Jan 15, 2012 10:27 pm
Weather Station: WA1080PC
Operating System: Windows XP SP3
Location: Oklahoma USA
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby oklaslim » Sat Feb 04, 2012 11:28 pm

I made the changes and still get the same thing.

My php file is being run from: http://littlerockfreewillbaptistchurch. ... eports.php

The data files are in: http://littlerockfreewillbaptistchurch. ... ther/noaa/

I made the change to ./noaa/ as suggested and still just get the Page header.
Slim
Woodland Junction East of Locust Grove, Oklahoma USA
http://littlerockfreewillbaptistchurch.com/Weather/index.htm

User avatar
beteljuice
Posts: 2465
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby beteljuice » Sun Feb 05, 2012 1:10 am

Your code:

Code: Select all

if ($Naming == 'WL') {
  $NOAAdir = './noaa/'; // point to your NOAA file sub-directry
  $ThisYearFile = "./noaa/NOAAYR2012.txt"; // point to your current NOAA yearly file
  $ThisMonthFile= "./noaa/NOAAMO0212.txt"; // point to your current NOAA monthly file
//  $LastYearFile = "./noaa/NOAAPRYR.txt"; // point to your prior NOAA yearly file
  $LastMonthFile= "./noaa/NOAAMO0112.txt"; // point to your prior NOAA monthly file
}
if ($Naming == 'VWS') {
  $NOAAdir = './noaa/';      // point to your NOAA file sub-directry
  $ThisYearFile = "$NOAAdir/NOAAYR2012.txt"; // point to your current NOAA yearly file
  $ThisMonthFile= "$NOAAdir/NOAAMO0212.txt"; // point to your current NOAA monthly file
}
if ($Naming == 'CU') {
  $NOAAdir = './noaa/';      // point to your NOAA file sub-directry
//  NO current NOAA month or yearly files
}
You have changed the format and 'hard coded' the names of files for options you are not using (WL and VWS)
... but your problem is the trailing / to your reports directory. (Which is NOT what Ray put above)

So the code should be:

Code: Select all

// *** Change below if your reports directory is different to the 'type' default ******************

if ($Naming == 'WL') {
  $NOAAdir = './NOAA-reports'; // point to your NOAA file sub-directry
  $ThisYearFile = "./NOAAYR.TXT"; // point to your current NOAA yearly file
  $ThisMonthFile= "./NOAAMO.TXT"; // point to your current NOAA monthly file
  $LastYearFile = "./NOAAPRYR.TXT"; // point to your prior NOAA yearly file
  $LastMonthFile= "./NOAAPRMO.TXT"; // point to your prior NOAA monthly file
}
if ($Naming == 'VWS') {
  $NOAAdir = './noaa';      // point to your NOAA file sub-directry
  $ThisYearFile = "$NOAAdir/noaayr.txt"; // point to your current NOAA yearly file
  $ThisMonthFile= "$NOAAdir/noaamo.txt"; // point to your current NOAA monthly file
}
if ($Naming == 'CU') {
  $NOAAdir = './noaa';      // point to your NOAA file sub-directry
//  NO current NOAA month or yearly files
}


Actually you've found a hiccough in the original script :)
If no suitable files are found an advisory is returned, but if the directory doesn't exist ......
Last edited by beteljuice on Sun Feb 05, 2012 12:53 pm, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !

oklaslim
Posts: 6
Joined: Sun Jan 15, 2012 10:27 pm
Weather Station: WA1080PC
Operating System: Windows XP SP3
Location: Oklahoma USA
Contact:

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Postby oklaslim » Sun Feb 05, 2012 3:59 am

Got it Thank you :D
Slim
Woodland Junction East of Locust Grove, Oklahoma USA
http://littlerockfreewillbaptistchurch.com/Weather/index.htm


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 1 guest