WEATHER STORY

Displays the selected Weather Story from most Weather Forecast Offices in the US
* Not all offices provide this product and not all offices use this on a daily basis
HOW IT WORKS
The Weather Story will be displayed from the default WFO location when the web page is opened. If the Weather Story is not found for the default WFO location, a message will be displayed.

If a selected WFO location has the Weather Story, it will be displayed along with any additional stories if provided.
The Weather Story title and location at the top of the page is linked to the NWS WFO site where the Weather Story was obtained.

If a selected WFO location does not have the Weather Story, a notification will be displayed in the headline bar. The WFO location at the top of the page is linked to the WFO web site.

WFO SELECTION - DROP DOWN MENU vs MAP
There are two options for the user to select a WFO. Either by a drop down menu or a graphical map. ($useWFOmap)
Depending on how you want the WFO location selection displayed, there are pros and cons to both.
Drop down menu
Pros - Fast page loading + Small display
Cons - Lots of scrolling + Plain appearance
Map
Pros - Fast way to select WFO's + Shows WFO coverage area
Cons - A little slower to perform the image construction + Creates 2 map cache files + Takes up space on web page
INSTRUCTIONS
SETTINGS All settings have a descriptions that are commented and located at the top of the Weather Story script.
Unzip the package and open the file wxStory_inc.php
Check the default settings and adjust them to your environment.
Be sure to consider the name of the cache file folder setting as it is important! Read about the CACHE FILE below before finalizing.
The Weather Story script, wxStory_inc.php, is not a web page and must be included in a web page template. Add the following code to your web page template.
<?php include("wxStory_inc.php"); ?>

CACHE FILE
A separate cache file folder should be used exclusively for the Weather Story due to the amount of files that accumulate in the cache folder.($ws_cachefolder)
Each WFO location produces one small data cache file plus any image displayed including any additional story images. There could be 8 or more image files per WFO location.
The cache folder will accumulate 100 megabytes of files!
An option is provided to automatically delete ALL of the files in the cahe folder every day when the web page is first visited after midnight.
The auto deletion of the cache files will not work if the cache file folder is set to the default folder named "cache".

THE MAP & FILES
A folder is included that contains 117 WFO mapped locations used for the overlay on the main map.
Create a folder, or use the default, and copy the images to that folder. ($wfomaps)
The main map is the only image file placed elsewhere. It must be placed in the 'images' folder. ($ws_mapfolder)
There are two maps in the cache folder that are used for displaying at each selected location.

DATA DOWNLOAD METHODS
Data and images can be dowloaded two different ways depending on availability and speed.
If downloading seems slow or times out, change the current setting at $useCURL to the opposite.

CSS
You can add a hover effect over the headlines by adding a few lines of code to the CSS style in the web page file where the Weather Story script is included.
.hdline:hover {
  background-color: #F0F7FF;
}

SETTINGS
$NWSregion Default location three letter WFO code
$useallwfos Option to display additional WFO locations or just the default location
$wstitle Top title for the Weather Story
$ourTZ Your time zone
$ws_cachetime Time in minutes to reatin the cached data before updating
$tablewdth Display width of map and data
$useWFOmap Option to use a map or drop down menu to select a WFO
$ws_mapfolder Folder to keep the main WFO US map
$ws_cachefolder Folder to keep the data and all WS images. May accumulate up to 100mb of disk space
$wfomaps Folder containing individual WFO coverage maps
$mapname File name of the main map without the extension in the images folder
$ift Main map file extension. Designate the image file type
$autocacheclean Auto delete cache files older than 1 day
$useCURL Uses cURL method to download. It seems faster than a stream.
ERRORS
"File not found..." or "Unable to open..." etc - File permission issue for folder. Adjust to 775.
The location shows no story but the WFO does. - The Weather Story location changed. Folder or https.
DISCLAIMER
This script is a "page scraper" that gets data from the web page markup at the NWS.
Having to get data from 117 different web sites, errors do occur and the script may pick them up and it may not work.
Embedded HTML and CSS is carried over from the source page and the Weather Story page may not validate.

Comments? Questions?
You can email me at curly@ricksturf.com