User Defined Variables

HAMweather has a full list of predefined variables that can be used in your templates, but at times, there may be a need for your own user defined variables.  For instance, you may want to pass a variable to dictate the background color, this way you could easily change it.  HAMweather will allow for these user defined variables.

A few notes about user defined variables syntax:

User Defined Variables : Usage

To use variables, you need to first define them.  You can define them  as a parameter in a url, command line or as a form element in a form to be submitted to HAMweather.

Defined as part of a URL

Simply set the variable as if it were like any other HAMweather parameter in an URL.   For Example: To Set 'hwvbgcolor' in a URL use the following:

Defined as a form element

All that needs to be done to set a user defined variable as a form element is to just name the form element with the name of the wanted variable.  For Example: a hidden form element for 'hwvbgcolor' would look like:
<INPUT type='hidden' name='hwvbgcolor' value='ffffff'>

Preset with the Web based administration

HAMweather allows you to preset user defined variables using the web based administration. Refer to this section on instructions on using this feature.

Now that the variable is defined you can put them into you HAMweather templates.

To output  the value of a variable, enclose the variable name in '%%' and put in your templates.  For Example: To ouput the value of the 'hwvbgcolor' you would od as follows:

<body bgcolor=%%hwvbgcolor%%>

In this example, HAMweather will output the value of the user defined variable 'hwvbgcolor' in place of the '%%hwvbgcolor%%'.

As of HAMweather 2.035 you can also set the values of userdefined variables in your hamweather templates.  In your templates you can use the new %%let hwvvarname= perl code here let%%.  This will 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

NOTE: If you want a user defined variable to follow around with the HW internal links, (I.E. a shopping cart number etc) YOu can set this in the User defined variable admin. This will make HW add the user defined variable as a parameter in the UVI table, Warning table and state maps. But it is still your jopb to add it to the nav.html and current.html templates or any other normal html templates.

Continue To HAMweather Include

HAMweather copyright 2000 by HAMweather, LLC, all rights reserved