|
Documentation (ASP) Setup Edit WeatherClass.asp and change the following parameters: '********Start Settings******** Sets Current conditions max cache age in minutes Const WEATHER_AGE_CC = 30 Sets 5 day forecast max cache age in minutes Const WEATHER_AGE_FORECAST = 120 Sets Combined forcast and current conditions max cache age in minutes Const WEATHER_AGE_ALL = 120 Sets Links max cache age in minutes Const WEATHER_AGE_LINKS = 3600 Sets the writable location on your server to store the cache files Weather_FilePath="c:\your file path to writable folder\" Sets the base image path on your server for the weather images Weather_ImagePath="/images/weather/" Sets the partner id provided by weather.com Weather_PartnerID = "000000000" Sets the license key provided by weather.com Weather_LicenseKey = "000000000" Sets the default weather location Weather_DefaultCode="90210" Sets the weather format; S=Standard M=Metric Weather_Format="S" If there is an error in the XML capture the weather will not be displayed. A friendly error will be returned. To use the old weather data instead of the error message enable the ErrorOverride Weather_ErrorOverride = False
Sets the allowable hostname to access the
weatherdata. Keeps people from using your JavaScript Translator on
another domain. Functions available MakeWeather The MakeWeather function sets asp variables of weather data based on a zip code and a weather type parameter. This function will show data from an existing file if it is within its allowed cache age, or will grab a new version from weather.com if the file is older than the specified cache age. Usage: Parameters
Example: <%Call MakeWeather("90210", "cc")%> -------------------------------------------------- ShowCurrentSm The ShowCurrentSm function shows a small panel of current conditions. Requires: Usage: Parameters
Example: <%Call ShowCurrentSm()%> -------------------------------------------------- ShowCurrentLg The ShowCurrentLg function shows a panel of detailed current conditions. Requires: Usage: Parameters
Example: <%Call ShowCurrentLg()%> -------------------------------------------------- ShowForecast The ShowForecast function shows a 5 day forecast Requires: Usage: Parameters
Example: <%Call ShowForecast()%> -------------------------------------------------- ShowLinks The ShowLinks function shows a panel of links to Weather.com. Required by the SDK rules. Requires: Usage: Parameters
Example: <%Call ShowLinks()%> -------------------------------------------------- ShowDiag The ShowDiag function displays all ASP variables generated for a given weathertype. This is useful in learning what variables are available to use. Usage: Parameters
Example: <%Call ShowDiag("all")%> -------------------------------------------------- MakeWeatherIcon The MakeWeatherIcon function creates an image tag for a given icon number Usage: Parameters
Example: <%Call MakeWeatherIcon(22)%> or <%Call MakeWeatherIcon(Weather_CurrentIcon)%> Real world examples of using the variables and handling errors are in the sample files.
|
|
Documentation (Javascript) If you have a non ASP page that you want weather data on, or do not want to include the weather code on your pages you can use javascript to capture and display the data. You will need the following lines:
The javascript file that is being used to
translate the data. The code to render the data
|
|
ASP Variables Location Data: (Always available) Weather_Error: True/False Weather_ErrorTxt: Text, Empty if error is False Weather_DefaultCode: Default zip code set in WeatherClass.asp Weather_Format: Standard/Metric Weather_Provider: Text required to give credit to Weather.com Weather_Logo32: 32 pixel Weather.com logo Weather_Logo64: 64 pixel Weather.com logo Weather_Location: City, State (and possibly zip code) Weather_LocationNoZip: City, State without zip code Weather_FetchTime: Time the data was captured from Weather.com. Timezone specific Weather_FetchSystemTime: Time the data was captured from Weather.com. Local server time Weather_Latitude: Number Weather_Longitude: Number Weather_TodaySunrise: Time Weather_TodaySunset: Time Weather_Zone: In relation to GMT Weather_TemperatureUnits: F/C Weather_DistanceUnits: mi/km Weather_SpeedUnits: mph/kmh Weather_PressureUnits: in/mb Weather_PrecipitationUnits: in/mm Current Conditions: (WeatherType=cc) Weather_LastUpdated: Time that the weather data was updated by Weather.com Weather_ObservationStation: Text Weather_CurrentTemperature: Number Weather_CurrentFeelsLikeTemperature: Number Weather_CurrentConditions: Text Weather_CurrentIcon: Number Weather_CurrentPressure: Number Weather_CurrentPressureMovement: Text Weather_CurrentWindSpeed: Number Weather_CurrentWindGust: Number Weather_CurrentWindDegrees: Number Weather_CurrentWindDirection: Text Weather_CurrentHumidity: Number Weather_CurrentVisibility: Number Weather_CurrentUVIndex: Number Weather_CurrentUVIndexTxt: Text Weather_CurrentDewPoint: Number 5 day forecast: (WeatherType=forecast) daynumber=day 0 (today) through day 4 0=Today 1=Tomorrow 2=Day after tomorrow Weather_DayName(daynumber): Weekday name Weather_Date(daynumber): Short date Weather_High(daynumber): Number Weather_Low(daynumber): Number Weather_Sunrise(daynumber): Time Weather_Sunset(daynumber): Time Weather_DayIcon(daynumber): Number Weather_DayConditions(daynumber): Text Weather_DayWindSpeed(daynumber): Number Weather_DayWindGust(daynumber): Number Weather_DayWindDegrees(daynumber): Number Weather_DayWindDirection(daynumber): Text Weather_DayPrecipitation(daynumber): Number Weather_DayHumidity(daynumber): Number Weather_NightIcon(daynumber): Number Weather_NightConditions(daynumber): Text Weather_NightWindSpeed(daynumber): Number Weather_NightWindGust(daynumber): Number Weather_NightWindDegrees(daynumber): Number Weather_NightWindDirection(daynumber): Text Weather_NightPrecipitation(daynumber): Number Weather_NightHumidity(daynumber): Number Weather_ForecastLastUpdated: Date Links: (WeatherType=links) Weather_Link1Url: Text Weather_Link1Txt: Text Weather_Link2Url: Text Weather_Link2Txt: Text Weather_Link3Url: Text Weather_Link3Txt: Text
|