HAMweather Include and SSI Simulation

HAMweather allows you to easily insert files into a template during output. This can be used to insert a common header or footer into your weather output. Thus, allowing you to simply change a couple files to personalize your weather site. (Those familiar with SSI will know the power of this option.).  Currently there are two methods to use insert files/script output into HAMweather output.  The basic most secure method bing HAMweather Include and the second being HAMweather Simulated Server Side Include (SSI).   Basical HAMweather Include is described below, followed by information on using simulated SSI in HAmweather.

Basic HAMweather Include

The process of using HAMweather include (HWI) is a two step process.

Step 1 Predefine Include Files

You must first predefine what files can be included and give each one a 'nickname'. The reason for this is better security. You can do this by using the web based administration HAMweather Include page. HAMweather comes with the following include files preset:

HAMweather Include Presets
Nickname Filename
header header.html
footer footer.html
nav1 nav1.html
nav2 nav2.html
nav3 nav3.html
form1 form1.html

The include files are set to be in the /templates/include directory of your HAMweather install.

Step 2 Insert HWI command into templates.

The second step to using HWI is to insert the HWI command into your templates. To do this, add the following in your templates where you want the file inserted:


Where 'nickname' is the predefined nickname of the file that you want to include. For Example: If we wanted to include the header file we would use the following:


Also, all included files go through the HAMweather parse engine, so you can include HAMweather variables in the files to be included as well. Actually you could even have an include file include a second file if needed.

Simualted Server Side Include

Many people use Server Side include to insert ads and/or other information  into their html documents.  Many of these same users would like to do the same with the HAMweather Output. (i.e. add banner ads tot he HAmweather output.).  You may think that you can simply add the SSI directives to the HAmweather templates and as HAmweather sent out the output the webv server would catch these SSI commands and parse them as well. Weel in an ideal world this woudl work , but becauseof security reasons etc, most web server will not perform SSI parsing on the output of a CGI script.  Because of this, HAMweather can simulate  three commonly used SSI commands.

First you must turn SSI simulation capabilities on.  To do this you will need to open the hwconfig.txt file and set the "$allow_SSI" to '1'.  Thus the line would look similar to:
    $allow_SSI = 1;

To torn the SSI Simulation capability off then you simply set the value back to zero:
    $allow_SSI = 0;

Now that SSI simulation capability is turned on you will simply add the SSI commands to your HAMweather templates and HAmweather will parse them as it outputs your templates.   The following three basic SSI directives are supported (Note they may act slightly different from the real SSI counterparts):

"Include File" Directive:  <!--#include file="/path/to/file"-->

This command will insert a file into the HAmweather output.  Basically it is very similar to the way that the basic HAMweather include works.  You must set file equal to a complete file path or it can be set to relative path to a file that is in the users 'include' directory.

"Include Virtual" Directive: <!--#include virtual="URLtofileorscript"-->

This command will insert a file or script output into the HAmweather output.  You must set 'virtual' equal to a relative or full url to the file or script to include.

"Exec CMD" Directive: <!--#exec cmd="path/to/script"-->

This command willinsert theoutput of a script/program into the hamweather output.   CMD must be set equal to a full path or to a url to a script.

NOTE:  The use of SSI simulation, like normal SSI,  can lower security on yoru server, thus it should only be used when absolutely needed.

Continue To Weather Icons