Email Address:
Password:

Lost your password?

This is the legacy website; please use the new website.

WIB: Web Server In A Box, Part 3

In Pt.2 last month, we showed you how to connect the WIB to a network and gave the step-by-step setting-up details. Most constructors will settle for the website provided but for those with special needs, this third article is for advanced users who want to customise the WIB to their requirements.

Pt.3: By Mauro Grassi

One of the advantages of the WIB is that you can customise it by designing your own website if you wish. For the purposes of this article though, we’ll assume that you know the basics of website design. Instead, we’ll just give a few basic pointers on dynamic content and running CGI (Common Gateway Interface) commands.

Designing your own website

Basically, it’s up to you whether you use the website we have provided with the WIB or one of your own design. It’s just a matter of copying the website you wish to use to the memory card.

When it comes to designing your own site, the best thing to do is to first examine the website we have provided and look at the source. We have used dynamic variables, as well as forms and Javascript.

There are plenty of HTML introductory tutorials on the web. Also you can use a freeware HTML WYSIWYG (What You See Is What You Get) editor such as Kompozer which you can download from http://kompozer.net

We used Kompozer to design the website provided with the WIB and you can change all its important settings if necessary.

Dynamic content

The WIB implements a simple system for dynamic content.

For dynamic pages, a string of the form ~XX, where XX represents a hexadecimal code between 00 and FF, is replaced by the value of that variable. Table 2 on the SILICON CHIP website gives a list of the hexadecimal codes and their corresponding variables.

Note that the files which are emailed are also considered dynamic content. For example, let’s say that we have a dynamically typed file containing the text:

Click for larger image
Note: the three tables referred to in the text (Tables 1-3) are too large to include in this article. Instead, you can download them in PDF format from the SILICON CHIP website. You’ll find them in the downloads section for Jan 2010.

The ~1E is currently ~D0 degrees.

From this, it follows that if the name of Variable 0 is set to “Temperature” and the current value for the temperature (derived from a temperature sensor connected to the first ADC input) is 26.5, then this would appear as:

The Temperature is currently 26.5 degrees.

As mentioned, any files sent by email, such as var0max.txt (on a maximum condition in variable #0), can also contain dynamic content. In order to show the ~ character you need to escape it by using the sequence ~~.

For example ~~02 will translate to ~02 yet ~02 will translate to the Subnet Mask (refer to Table 2).

The default var0max.txt file contains the following text:

The ~1E is currently at ~D0, which is above the set maximum of ~1C!

Share this Article: 

Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2021 Silicon Chip Publications Pty Ltd All Rights Reserved