CFX_WeatherForecast
About
CFX_WeatherForecast is a ColdFusion Custom Tag that provides U.S. weather forecast information.
Examples
Weather Forecast for Honolulu, Hawaii (ZIPCODE Attribute available in Registered version only) <cfx_WeatherForecast FORECASTDATE="2006-12-03" ZIPCODE="96813" DAYFORECASTICON="C:mywebsiteday.jpg" NIGHTFORECASTICON="C:mywebsite ight.jpg">
<cfoutput> HONOLULU, HI WEATHER FORECAST FOR DECEMBER 3, 2006 Daily Low Temperature: #WeatherForecastLowTemp# deg. Daily High Temperature: #WeatherForecastHighTemp# deg. DAY #WeatherForecastDayWeatherProbability# #WeatherForecastDayWeatherIntensity# #WeatherForecastDayWeatherType# during the day Chance of Precipitation: #WeatherForecastDayPrecip#%
NIGHT #WeatherForecastNightWeatherProbability# #WeatherForecastNightWeatherIntensity# #WeatherForecastNightWeatherType# at night Chance of Precipitation: #WeatherForecastNightPrecip#% </cfoutput>
Example Output will be:
HONOLULU, HI WEATHER FORECAST FOR DECEMBER 3, 2006
Daily Low Temperature: 64 deg. Daily High Temperature: 78 deg.
DAY likely heavy rain during the day Chance of Precipitation: 80%
NIGHT chance light rain at night Chance of Precipitation: 30%
Example #2 Weather Forecast for a Longitude / Latitude <cfx_WeatherForecast FORECASTDATE="2006-12-03" LONGITUDE="42.904958" LATITUDE="-78.700600" DAYFORECASTICON="C:mywebsiteday.jpg" NIGHTFORECASTICON="C:mywebsite ight.jpg">
Installing CFX_WeatherForecast
1.) Copy the WeatherForecast.class file into your ColdFusion java classes folder. On Windows, this folder is usually located at:
CFusionJavaclasses or CFusionMXcfxjava 1a.) Make sure the folder that you copy the WeatherForecast.class file into is located in the ClassPath in the ColdFusion Administrator. 2.) Go to ColdFusion Administrator in your web browser, then click on CFX Tags (under Extensions)
3.) Click Register Java CFX
4.) For Tag Name, type: CFX_WeatherForecast For Class Name, type: WeatherForecast
5.) Submit Changes
DOCUMENTATION
SYNTAX
<CFX_WeatherForecast FORECASTDATE = "date (yyyy-mm-dd)" LONGITUDE = "float" LATITUDE = "float" ZIPCODE = "text" DAYFORECASTICON = "text" NIGHTFORECASTICON = "text"> ATTRIBUTES
FORECASTDATE Required. The date for which you want the weather forecast. Date must be in the form yyyy-mm-dd. Example: FORECASTDATE = "#DateFormat('12-25-2006', 'yyyy-mm-dd')#"
LONGITUDE Optional (Required in Evaluation Version). The longitude of the area you wish to receive the forecast for. Longitude must be in decimal format. Example: LONGITUDE = "42.904958"
LATITUDE Optional (Required in Evaluation Version). The latitude of the area you wish to receive the forecast for. Latitude must be in decimal format. Example: LONGITUDE = "-78.700600"
ZIPCODE Optional. Available only in Evaluation Version. The Zip Code of the area you wish to recieve the forecast for. Example: ZIPCODE = "33952"
DAYFORECASTICON Optional. The absolute path to a file which will contain an icon representing the day-time weather on FORECASTDATE. Example: DAYFORECASTICON="C:mywebsiteday.jpg"
NIGHTFORECASTICON Optional. The absolute path to a file which will contain an icon representing the night-time weather on FORECASTDATE. Example: NIGHTFORECASTICON="C:mywebsite ight.jpg"
RETURN VARIABLES
WeatherForecastLowTemp = The daily low temperature (in degrees Fahrenheit). WeatherForecastHighTemp = The daily high temperature (in degrees Fahrenheit). WeatherForecastDayPrecip = The day-time probability of precipitation. WeatherForecastNightPrecip = The night-time probability of precipitation. WeatherForecastDayWeatherProbability = The day-time weather probability (ex. likely, chance, definately). WeatherForecastDayWeatherIntensity = The day-time weather intensity (ex. light, heavy). WeatherForecastDayWeatherType = The day-time weather type (ex. showers, snow, clear). WeatherForecastDayWeatherSummary = The day-time weather summary (ex. Chance Snow Showers) WeatherForecastNightWeatherProbability = The night-time weather probability (ex. likely, chance, definately). WeatherForecastNightWeatherIntensity = The night-time weather intensity (ex. light, heavy). WeatherForecastNightWeatherType = The night-time weather type (ex. showers, snow, clear). WeatherForecastNightWeatherSummary = The night-time weather summary (ex. Snow Showers Likely). WeatherForecastMessage = The return message (ex. OK, ZIPCODE not found, etc.)
Possible WeatherForecastMessage values include:
Must supply required attribute FORECASTDATE in the form yyyy-mm-dd. Date must be in the format yyyy-mm-dd. Could not find latitude / longitude coordinates. ZIPCODE not found. Other unpredictable errors.
|