Customization: Introduction

Once you have installed HAMweather and started using it, you will then want to begin customizing it to you specific needs.  Customization of HAMweather comes in several forms.   You can customize the various weather icons, templates, create themes and even allow for multiple  users to have their own customized weather sites.  The following sections review the various aspects of this customization process so that you can perform the customization yourself, but if you prefer, HAMweather, LLC offers customization services.  These services can include custom template and icon design or even the creation of custom themes.  For more information or request customization services refer to the HAMweather, LLC customization page.

Customization : Templates

Customizing the HAMweather templates is probably the most common and easiest way to customize HAMweather to match your needs.  The templates that come with the HAMweather distribution are in the templates directory of the HAMweather CGI path. (Yes, these templates do belong with the cgi scripts, for web visitors will not be viewing them directly.)  In this directory you will find several templates that came with the HAMweather distribution or from the Pro .

You may now be wondering, "How do I know what each template is used for?"   The  following table reviews what each template in the distribution is used for. You can actually modify what templates are used by using the HAMweather web administration.

HAMweather Templates
Template Name Description
canada.html Used to display the canadian provinces to choose form for forecast.
ccinternational.html Used to display the international countries that metar observations are available for..
ccus.html Used to display the states that metar observations are available for.
hourly.html Used to display the hourly conditions or the metar observations
intzone.html Used to displayt he zone forecast for international locations (Currently only Canada)
metarlist.html Used when displaying all the locations in a country or state that the metar observations are available for.
noforecast.html Used when the forecast for a city could not be found.
other.html Generic template used when displaying state level text based reports, warnings, watches, state forecasts, etc...
otherinfo.html Used to display the other national weather information that is available.
shortterm.html Used to display the shortterm forecast
statehourly.html Used to display the State hourly round up.
statemap.html Used when displaying a regional or state image map.. which is clickable for individual zone forecasts
usother.html Generic template used when displaying national level text based reports, warnings,  etc..
uswarning.html Used when displayig US wanrnings
uvi.html Used when displaying the Ultraviolet Index table
zandh.html Used when displaying both the zone forecast and hourly conditions.
zone.html Used when displaying zone forecast.
HAMweather Pro   Templates
NOTE: The HAMweather Pro  uses modified versions of the normal HAMweather templates plus the following.
nf.html Used when displaying the National Forecast Map.
ns.html Used when displaying the National Summary Map.
radar.html Used when displaying the National Radar Map.
uswarning.html Used when displaying the National Warning Map.

These template can be designed using most any web authoring utility.  The difference between making an html page and the template is that the templates are a "basic" design with variable names inserted where HAMweather is to insert data.

The variables used by HAMweather use the following format:  %%variablename%%

Thus, If you want the current state to be outputted in the template then add %%state%% to the template where you would like the current state name to be placed.

There are many variables that can be used in your HAMweather templates.   The following table lists them.  Some variables are only available for certain forecast types.  This is indicated as well.

Variable Name Description
Standard Variables
%%scripturl%% The URL to the hamweather.cgi script
%%getstateurl%% The URL to the getstate.cgi script
%%metarlisterurl%% The URL to the metarlister.cgi script
%%emailstorerurl%% The URL to the hw2email_storer.cgi script
%%mapimagesurl%% The URL to the HAMweather Pro national maps
%%main_html_url%% The URL to the main HW directory.
%%imagesurl%% The URL to the main HW images directory
 
%%pands%% The "place, state" or zipcode combination.
%%zipcode%% The zipcode entered.
%%place%% Current Place needing forecast for
%%lcplace%% Current Place needing forecast for with proper casing
%%lplace%% Current place with proper html encoding (spaces turned to "+", etc)
%%state%% Current State needing forecast for. (abbreviation) Note: Even is user types in the full state name this variable will only be the two letter abbreviation.
%%lcstate%% Current State needing forecast for with proper casing and full name.
%%lstate%% Current state url encoded.
%%country%% Current Country needing forecast for
%%lcountry%% Current country URL encoded (spaces turned to "+", etc)
%%lccountry%% Current Country needing forecast for with proper casing.
%%icao%% The Current ICAO code of place needing observation for.
%%zone%% The weather zone number supplied by user. (Only available is supplied)
%%zforecast%% The text based portion of the forecast
%%forecastdate%% Date of the needed forecast
%%forecastneeded%% The actual forecast type requested.
%%lcforecastneeded%% The actual forecast type needed with proper casing
%%stateimagesurl%% URL to the state images directory
%%iconwidth%% The width of the wx icons
%%iconheight%% The height of the wx icons
%%statemap%% or %%imagemap%% The state image map for the current state (specified by state parameter)
%%metarlist%% or %%list%% The list of places to get current conditions for. the "abbrev" paramter must be set to the state or country abbreviation.
%%statehourly%% The state hourly round up
%%user%% The current user name
%%theme%% The current theme
Variables for use with the Zone (includes zandh) Forecasts Only
%%activewarning%% Displays the current active warning/watch or special message if feature is turned on.
%%iconrow%% The table row that holds all the weather icon coding for the zone forecast
%%daytitlerow%% The table row that holds the corresponding day titles for the weather icon row
%%weatherrow%% The table row that holds the corresponding weather conditions for the weather icon row
%%temprow%% The table row that holds the corresponding temperatures for the weather icon row.
%%num_zone_days%% The number of days avaliable for the wetaher icon row
%%day_title#%% This is the day title for icon # in the icon row
%%day_weather#%% This is the weather conditions for icon # in the icon row
%%day_icon#%% This is the url to weather icon for icon # in the icon row
%%day_temps#%% or
%%day_temps#HL%%
The HI and LO temps for icon # in the icon row.
Displays as: HI:24F  LO:12F
%%day_temps#N%% or
%%day_temps#HLN%%
The HI and LO temps for icon # in the icon row, but with out the "HI" or "LO" text.
Displays as : 24F  12F
%%day_temps#H%% The HI  temps only for icon # in the icon row
Displays as : HI:24F
%%day_temps#/HN%% The HI  temps only for icon # in the icon row, but with out the "HI" text
Displays as : 24F
%%day_temps#L%% The  LO temps only for icon # in the icon row.
Displays as : LO:12F
%%day_temps#LN%% The LO temps only for icon # in the icon row, but with out the "HI" or "LO" text.
Displays as : 12F
Variables for use with the Hourly and Metar Observations Only
%%hicon%% URL to the icon for current weather condition
%%hname%% The name of the current place
%%hsky%% The  sky condition (weather condition)
%%htempf%% The temperature in Fahrenheit
%%htempc%% The temperature in Celcius
%%hdewptf%% The dew point in Fahrenheit
%%hdewptc%% The dew point in Celcius
%%hrh%% The relative humidity
%%hwind%% The wind speed in Miles per hour and direction (includes gusts if available)
%%hwind_nogusts%% The wind speed in MPH and direction but no gust measurement
%%hwind_gusts%% The wind gusts speed only (if available) in MPH
%%hwind_knots%% The wind in knots (includes gusts if available)
%%hwind_knots_nogusts%% The wind in knots but no gust measurment
%%hwind_knots_gusts%% The wind gusts speed only (if available) in knots
%%hwind_mps%% The wind in Meters per Second (includes gusts if available)
%%hwind_mps_nogusts%% The wind in Meters per Second but no gust measurement
%%hwind_mps_gusts%% The wind gusts speed only (if available) in MpS
%%hwind_kmh%% The wind in Killimeters per Hour (includes gusts isifavailable)
%%hwind_kmh_nogusts%% The wind in KM/H but no gusts measurement
%%hwind_kmh_gusts%% The wind gusts speed only (if available) in KM/H
%%hpressure%% The barometric pressure in inches unless metric=1 then in millibars
%%hpressure_mb%% The barometric pressure in millibars
%%hremarks%% Possible additional Hourly remarks
%%hhif%% Heat Index in Fahrenheit
%%hhic%% Heat Index in Celsius
%%hwcf%% Wind Chill in Fahrenheit
%%hwcc%% Wind Chill in Celsius
%%hforecastdate%% The Hourly forecast date and time
Variable for use with the hwgetstate.cgi Script Only
%%getstateimagesurl%% This provides the URL to the proper state image when displaying a state image map that can be clicked to get a zone forecast
%%imagemap%% This is the actual image map coding for the above map
Variables for use with the metarlister.cgi Script Only
%%list%% This is the actual list of places either in a state or country that the metar observations are available for.
Variables for use with the hw2email_storer.cgi Only
%%address%% This is the email address that is being subscribed or unsubscribed
Variables for use with HAMweather Pro  Only
%%usnsmap%% or
%%usccmap%%
The url tot he US National Summary Map
%%usfcmap%% The url to the US National Forecast map
%%uswarningmap%% The url to the US warning map.
%%warningtable%% Table of the states that have an active warning.  Each state is a hyperlink to the individual state warnings page.  Used with the National warning (uswarnings) report.
%%usradar%% The URL to the national Radar image
%%radarzoneimg%% The URL to the regional radar image
Used Defined Variables
%%hwvxxxx%% HAMweather allows user defined variables to be passed and inserted into the output.   Refer to the User Defined Variables page for more info.
Misc Variables
%%current_month%% The name of the current month
%%current_month_num%% The number of the current month (from 0 to 11)
%%current_day%% The current day in the month (1 to 31)
%%current_year%% The four digit number of the current year.
%%admin_email%% The email to the site administrator
%%metric%% The current metric usage setting
%%celsius%% The current celsius usage setting
HAMweather Include
%%hwi=xxxx%% HAMweather allows you to include files in the output. This can be used to have a custom header or footer for all the templates.  Thus allowing you so simply edit a couple files for the entire weather site.
NOTE: if the XXXX portion of the HWI template variable includes another variable, the "other" variable will be translated first.  This is you had %%hwi=current%%metric%%%% HAMweather would parse the %%metric%% before parsing the HWI. Thus if %%metric%% equals "1" then effectively you owuld have:   %%hwi=current1%%
Server Side Include (SSI) Simulation
<!--#include file="/path/to/file"--> Can be used to simulate the SSI "Include file" directive. File must be set to a relative file in the users include directory or a complete path to a file. (SSI Simulation must be enabled for this to work. Default is disabled)
<!--#include virtual="urltofile"--> Can be used to simulate the SSI "Include virtual directive.  virtual must be set to a releative or complete URL to file/script to include/execute.
Inlcude Perl code in Templates
%%let hwvvarname= codehere let%% Well set the hwv variable "hwvvarname" to the value returned by the perl code between = and the "let%%. Examples:

%%let hwvvarname= 34 let%%     : Will set hwvvarname to the value 34
%%let hwvvarname= "this is a test" let%%    : will set hwvvarname to "This is a test"
%%let hwvvarname= my $a = 20 + 2; $a; let%%   : will set hwvvarname to the value of 22

%%perl Perl code here perl%% Will parse the perl code bewteen the "%%perl" and "perl%%" and replace it with the returned value. NOTE: The perl code must all be on one line.

Examples:
%%perl my $a = 20 +2; $a; perl%%   : will be replaced with the value 22
%%perl my $a = uc "%%hsky%% "; $a; perl%%    : will be replaced with the value of %%hsky%% in uppercase

This can be a very powerful addition to your templates

Now to User defined Variables.

HAMweather copyright 2000 by HAMweather, LLC, all rights reserved