Uncle Roger's
Automated Web Page Generator

I collect classic computers. I also love reference material. (And I love the web as a publishing medium for reference material, but don't get me started on that!) So I wanted to develop a set of web pages to showcase my collection and provide a resource for those researching the computers I have.

Unfortunately, I'm also incredibly lazy. (Or, perhaps fortunately, in many cases.) I really didn't want to have to put together web pages for each computer -- a very repetitive task, once the layout was developed.

And that's not even considering the maintenance nightmare individual web pages for 60+ computers would represent. Also, I'm always looking for old computers to add to my collection (hint, hint).

So I stole a few weekend hours late at night and wrote myself a web page generator to do the work for me.

This, then, is my story.

The Layout

I had my design pretty well hashed out. There would be a title naming the computer and giving a short description. Next would be a few paragraphs describing the computer, offering some personal anecdotes, general information about the computer, and perhaps a description of how I came to get the example in my collection.

This text would flow around a sidebar on the right side containing links to various web pages offering support, additional information, and so on, relating to the computer. Below the text would be a horizontal line (or rule in web parlance) separating the next section.

The lower section would consist of a series of photos of the computer and its accessories, one above the other, to the left, and a table listing the machine's specifications on the right. Each photo would have a caption describing it.

Below that would be another horizontal rule and a simple "navigation bar" allowing the user to easily return to the index, or to my home page and to provide closure -- a page footing of sorts.

Data Definition

So, there are really four major categories of information that varies from computer to computer: The descriptive text, the links and their descriptions, the images (filenames, sizes, etc.) and their captions, and the specifications of the computer.

Everything else -- the color settings, the navbar, the general layout -- stays the same. After some iterations, I settled on the following set up:

There are six files that control the layout; these are the same for all pages. They are stored in the Template directory (or folder), and are:

Filename Description
main.htm The main template for the entire page
datatabl.htm The layout for the list of specifications
images.htm The layout for each image
navbar.htm The navigation bar for the bottom of the page.
rsctabl.htm Table layout for resource links
rsclink.htm Layout for each link within the table
In addition, there are four data files for each computer, located in the Data directory. Each file is named for the computer (as in macport for the Mac Portable,) with an extension indicating the type of data file. These data files are:
Extension Description
.txt Descriptive text
.dat Specifications and various variables
.rsc List of resources, with URL's and descriptions
.img List of images, with filenames, sizes, and captions
These templates and data files are combined to generate individual web pages for each computer.

Program Operation

The program prompts for the filename for the computer whose web page is to be generated, and then reads the main template file to begin generating the web page.

Each template file contains HTML code interspersed with keywords (indicated by being enclosed in curly braces: "{" and "}"). When the program encounters a keyword, it either begins processing a specific section of the web page, or searches for a matching keyword (and associated information) in the .dat data file.

Anything found in the template files that is not a keyword is simply copied directly to the web page being generated. Keywords are processed and not written to the web page.

Note: The resulting HTML code is rather unpleasant to read. This is because I chose to develop this system in BASIC and opted for speed of creation over full functionality.

Had I chosen a language with better string handling/parsing features, or taken the time to improve the parsing code in the program, keywords could have been allowed anywhere within the HTML code. As it is, keywords must be placed at the beginning of a line and must be the only text on that line.

In addition to allowing for a quick development time, BASIC offers almost universal compability (Are there any computers for whom a version of BASIC is not available?) and ease of comprehension to allow others to understand and modify the program for their own use.

There are five keywords that trigger specialized sections of code. These are: {text}, {resources}, {data table}, {navbar}, and {images}. Any other keywords are either handled within one of the subroutines associated with these five keywords, or are assumed to be references to data items in the .dat data file.

Data item keywords initiate a sequential search of the .dat data file until a matching keyword is found. The record following the keyword is then read and inserted into the web page file.

For example, the <Title> text, located in the Header section of the web page, is stored in the .dat data file, and is read during the processing of the main template file. The {Title} keyword would initiate a search for a matching keyword, and the subsequent data record containing the page title would be written to the web page file.

If no matching keyword is found in the data file, a blank line is written to the web page file. A future enhancement will be to allow for data items that span multiple records, requiring an end-of-data marker (perhaps {eod}?).

The five reserved keywords are each handled by their own dedicated subroutines. They are invoked when the appropriate keyword is encountered in the main (or subidiary) template file.

They are handled as follows:

{text} Opens the .txt file and reads each record until EOF is found. If the record is null (i.e., length is 0, value = "") then a paragraph mark (<P>) is written to the web page. Otherwise, the record is written out as is. HTML code is acceptable, and will be inserted into the web page without change (except for blank lines.)
{resources} Opens the file RscTabl.htm in the Template directory and reads each record until EOF is found. If the keyword {rsc list} is found, another subroutine is called to handle the actual list of resource links. All other records are written to the web page as is.
{data table} Opens the file DataTabl.htm in the Template directory and reads each record until EOF is found. If a keyword is encountered, the appropriate .Dat file is opened and read through until a matching keyword is found. If the keyword is found, the associated data (the following record in the file) is written to the web page. If the keyword is not found, a blank line is written. All other records are written to the web page as is.
{navbar} Opens the file NavBar.htm in the Template directory and reads each record until EOF is found. Each record is written as is to the web page.
{images} Opens the file Images.Dat in the Data directory and reads the URL, description, height, width, and alternate text for each picture. After reading the image information, the Images.htm file in the Template directory is read. Each record from the Images.htm file is either replaced by one of the data fields, if it is one of the image keywords, or written to the web page as is.
{rsc list} Opens the appropriate .Rsc file and cycles through, reading the Resource URL and description. (The description is broken into three parts, each on a separate record, to differentiate between the text that comes before, comes after, and is used as the actual link.) After reading the resource information, the RscLink.htm file is read from the Template directory and used to format the link.
By using this combination of templates and data files, the layout for all the web pages can be updated easily simply by changed the appropriate template file and rebuilding the actual web pages. Likewise, the information for a single computer can be updated by changing the relevant data file, eliminating the possibility of altering the layout or other types of data.

Hopefully, this description is adequate to allow others to utilize and customize this program for their own needs (note that with a few changes to the template files, this system could be put to use in many areas.) If, however, you have any questions about the program or the resulting web pages, please e-mail me so that I can update the documentation.

Legalese: Anyone is welcome to copy and/or modify this program, the associated data files, and/or the associated template files for their own, personal, not-for-profit use, so long as you a) give me (Uncle Roger) credit and b) include a link from somewhere in your site back to either my classic computer web pages, my personal home page, the Roger Louis Sinasohn and Associates home page, or this page.

If you wish to use this system on a commercial site, or as part of any profit-motive venture, contact me to discuss my very lenient terms. Unauthorized use will result in legal action.

Now, if you want to use my web page generator, it comes as a zip file containing:

Move the .Zip file to the directory you will be working in and unzip it with the -d option to create the appropriate subdirectories. Or, just unzip it, and move the files around manually. Note that the program expects the template files to be in a Template directory and the data files to be in a Data directory.

If you're ready, you can go ahead and download the whole shebang now.

Uncle Roger's Classic Computers
Personal - Business - Computers - Resources - Add Info