Weather by You!

Templates and Projects support => Modules => Topic started by: avoorpool on December 27, 2012, 10:49:58 PM

Title: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on December 27, 2012, 10:49:58 PM
Hi Jacques,

Hopefully the Storm in Quebec hasn't effected you too much and were you able to dig yourselve out of 50 cm of snow... :o

I've added a few weather alerts to my main page in the Temp/Wind/Rain etc sections (using the Alarm settings in Cumulus + LED light), however when it comes to the 'offical' Warnings/Alerts from Envirnoment Canada (most likely many to follow during the Snow season), I always refer to my EC forecast page via the Cumulus Main screen  'Current Conditions' input.
In the 'forecast_ecl.php' there is a section that 'handles' these Alerts/Warnings.
Is there a way to 'copy/paste' this into my main page, so it will be shown under the 'Forecast' section when applicable??

Thanks,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 05, 2013, 01:25:33 PM
Hi Jacques,

Still waiting for a hint in this direction, how to implement the Environment Canada Weather Warnings/Alerts into my index page.
Is it s 'simple' copy of the string which is used in the 'forecast_ecl.php' script??

Thanks,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on January 05, 2013, 04:23:30 PM
Hi Arthur,

Yes, you could use forecast script and strip all uneeded lines,
but it is a bit big, only for that purpose! Saratoga has not
a script only for that?

Cheers,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 05, 2013, 04:36:59 PM
HI Jacques,

Thanks!!
I'll wait till a warning/alert appears on Environment Canada to see how it looks!!

In the mean time, my index page has a set of 'new' icons  :)  (in a 'blue-style'.......)

Cheers,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on January 05, 2013, 05:21:01 PM
Hi Arthur,
I see your new icons set... what a job!... real cute!  :-*

Maybe a good thing to make a page for them... and ZIP them
to not being into obligation to do 116 individual downloads!!  :-[

If you want, I host them!  ;)

Cheers,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page + New Icon Set
Post by: avoorpool on January 07, 2013, 11:05:52 AM
Hi Jacques,

Thanks for the hint..!!!
When I entered my post, I realized it would be a 'job' to download all individual.
However, I've zipped them, and they're in the same folder as 1 .ZIP folder:
http://www.altonaweather.ca/downloads
Of course, please feel free to 'host' them!!!!  ;)

NEW Column on Index Page instead of 'boxes'....!!!!
Also, over the weekend I decided to make 1 column on the right side of the index page, instead of all different boxes with 'Current Weather', 'Moon Phase', 'Forecast Image' etc, etc.
It turned out very nice (it 'melts into the background when you scroll the page) and the column measures just 270 x 2340 px.....  :)
I made the 'separation' titles in colour equal to the left-side <span> title bar......

Looks better with the (mnay) different info sections on the page I think.....

Cheers,

Arthur

Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on January 07, 2013, 05:38:48 PM
Hi Arthur,

I've seen your "new column" and found it very interesting!
Beyond a certain number of boxes, layout was less attractive!
... with that new column you put a certain "balance" with
the rest of the page

Bravo,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 07, 2013, 07:26:03 PM
Hi Jacques,

Thanks again and again  :)
Remember WHO gave all the Weather Blues enthusiasts & users a great opportunity to 'experiment' with this wonderful  template?? You, Mr.Webmaster himself!!!!!!
It turned out to be a 'more-than-expected' play-ground for me to make myself (from scratch) a bit more familiar with HTML and PHP.....

Indeed, the column contributes to a nice 'balance' on the page.

Cheers,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 25, 2013, 01:07:01 PM
HI Jacques,

Currently there is a EC Warning in efect (see attachment) and thus the only time I can check if it works on other pages.
The part of the 'forecast_ecl.php' in regards to Warnings is:
<?php
if (isset($ec_alert)) {
for($inc = 0; $inc < count($ec_alert); $inc++) {
if ($ec_alert_type[$inc] == 'watch')
$alert_color = '#FFFF7F';
else
$alert_color = '#FF7F7F';
echo '<p class="alerts" style="background-color:'.$alert_color.'">&nbsp;'.$ec_alert_type[$inc].'</p>';
echo '<div class="alert" style="border-color:'.$alert_color.'">';
echo '<p>Priority: <strong>'.$ec_alert_priority[$inc].'</strong>&nbsp;&nbsp;&nbsp;&nbsp;Issued alert: <strong>'.$ec_alert_date[$inc].'<br /> '.$ec_alert[$inc]."</strong></p>\n";
echo '</div>';
}
}
?>

Question:
Is this the part I have to enter into my indexT page??
If so: How and where should it be implemented???

Thanks,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 27, 2013, 05:37:41 PM
Hi Jacques,

This is what it looks like on my (XAMPP) IndexT.htm page......
Not much to see. (Another Warning (Freezing Rain) is in place at the moment).

Can you give me some advise of how to implement the correct (EC Alert) code into the IndexT.htm page??

Thanks,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on January 27, 2013, 08:10:50 PM
Hi Arthur,

I haven't time to look at that these days, but you couldn't just extract
these lines from the package because other part are for parsing the
source file to give the variable that you want to use ...IF IT'S SET (issset)

Then, you could go in that way, you could strip many parts of forecast_ecl,
but no require or include!

Hope this help,

Regards,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 28, 2013, 07:07:57 AM
HI Jacques,

Thanks for your advise!!!
All worked out well. (See attachment)

One more question remains......
I upload my files every 5 mins.
Normally, Cumulus uploads the indexT.htm file.
I renmaed this file into indexT.php, to make the PHP insertion workable.
How do I change the upload of the standard Cumulus file, so it will be indexT.php every 5 mins...  ;)

Thanks,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 28, 2013, 11:16:01 AM
Hi Jacques,

Cumulus upload is all set (added the index.php file to Cumulus.ini for continuous 5 mins upload).

I've added a "Weather Statement' message before the actual EC statement (attachment).

You guess it  ;)....???

I would like to add to the 'ec-alert' script a text that says (in case there are NO warnings/alerts):
"There are currently no weather statements from Environment Canada"

I've checked the 'ec-forecast.php' but can't find such a message. (Obviously No News = Good News  :))
However, where and in what context do I add this message in the script??

Thanks,

Arthur

Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on January 28, 2013, 11:23:08 AM
Hi Arthur,

I'm happy to see that things are going good on these alert now!
To process your new file you have to tell Cumulus to process it
like other optional pages. To do so, simply follow instructions in
"Cumulus configuration" at bottom page of This link (http://weatherbyyou.com/wb_install.php)

But a little thing to verify is a chance of page conflict. The optional
page processing you will do on this new index.php page will bring
2 index page on your site and browsers will be "fooled" by that, I don't
remember which one (php or html) will "win this fight" and if it will be
the same "winner" for every browser!

You could try to remove the old indexT.html file in C:\Cumulus\web
folder, but I don't know how Cumulus will react if he has to process/send
only 6 out of 7 files! Then, some test to do!!

Hope this help!

Regards,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 28, 2013, 11:32:01 AM
Hi Jacques,

In return to your post:

I've set a priority 'default' page on my webserver in 'htaccess' for the webaddress http://altonaweather.ca, being the 'index.php' file.
Indeed Cumulus uploads an index.htm file, but shows this a 0 KB.
The normal FTP process I've added to 'Cumulus.ini' so it will happen every 5 mins for the index.php file.

Looks lke it's working fine.

Cheers,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on January 29, 2013, 05:43:38 PM
Hi Jacques,

The EC Weather Alert is coming to a 'close'.
I deleted most of the script, keeping the essential section for Alerts in tact and saved it as 'ecalerts.php'.
Used the 'include' in my index page.
I realized that the script is not the original Saratoga 'ec-forecast.php' but one that is (perfectly) modified by you into the short and long 'forecast_ecl.php' script (I use the 'ecl version).
So I asked Ken, and he gave me a small addtion to the script I use, so now when there is no Alert/Warning there is still a message displayed ("No active Weather Statements.......").
(Can't check it, since we're still under a freezing rain Warning  ;)

Cheers,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on February 05, 2013, 12:14:47 PM
Hi Jacques,

You know very well, I'm keen in keeping my webpages 'clean' without errors. All pages are W3C validated and 'green' except for the index page.
Since I (successfully) implemented part of the 'forecast_ecl.php' script (created for this the 'ecalerts.php' file (attached), and used $include=true within the index page), it displays the EC Weather Statements, however it shows an error  >:D  >:( (see attachments).
Most likely it's because part of the EC Alerts is taken from the 'forecast_ecl.php' script, and (already) contains the <!DOCTYPE> section which is also in place within the 'index.php' template file.
With all of your excellent expertise, is there a way to eliminate this error and have the alert messages correctly displayed???

Thanks for your help,

Cheers,

Arthur

Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on February 05, 2013, 07:25:25 PM
Hi Arthur,
Ahhhhhh perfection is a serious disease!!   :))

But for your page, try to remove all that is not php! (ALL after ?> )
You'll loose only styling on alert and alerts, that can be moved
into your index page, or your.css file!

Regards,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on February 05, 2013, 09:36:33 PM
Hi Jacques,

AWESOME...!!!!

Thanks a lot.
Index.php is 'Green' again.

Just need a few adjustments to the weather statement alerts (display), but the errors are gone!!!
(I put it in <style> within the index page, but will try it in the CSS.)

Thanks again,

Arthur
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: Mr.Meteo on February 06, 2013, 11:28:34 AM
Hi Arthur,
Happy that it help you a bit!  :)

But, for the styling move, possibly you could use that logic:
Try to always think like a woman... as being a weight paranoiac! :-X
Most visitors have fast internet, but not all! Then with styling, try
to be as "Scrooge" as possible:

1 - If it is for only 1 place in 1 page, put your style "inline":
e.g. <p style="width:300px;...">...

2 - If style is use more then 1 time, but only in one page:
Use <style type="text/css>... </style> in "head" section of that page!

3 - If used in many pages, then use the .css file

A little trick to save some little "%", but with some of them you could
be noticiably faster!

Regards,
Jacques
Title: Re: Environment Canada Weather Alerts on Main Page
Post by: avoorpool on February 06, 2013, 11:41:53 AM
HI Jacques,

Thanks for the message! That makes sense!!!!

I'll give it a try, although I've entered the "no weather statements' announcement, (displayed when no warnings/alerts are in effect) into the 2 EC scripts as well. Therefore I've entered it into the CSS settings, and it all works perfectly.
However, it's definitely worth a try, to put it 'inline'

Cheers,

Arthur