ECN No Name Newsletter: September, 1996

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

Why Generate On The Fly

NO NAME NEWSLETTER -- September 1996

Brad Barrett


On the old ECN engineering student organization pages, data such as the officers, address, phone, advisor etc. on over 55 organizations were presented in individual HTML files for each organization using a consistent layout, and the HTML files were indexed in a "Engineering Student Organizations" homepage.

Unfortunately, student organizations change officers at least once a year, and much of the other information was prone to growing stale. Updating the individual HTML files was a time-consuming task. Maintaining a large set of HTML files containing similar information can be difficult when that information is dynamic. What if the information in some of them has to be changed? Do you edit by hand each file in which a listed address has changed? What if you want to change the hypertext layout of all the files? Perhaps if you're lucky you can write a PERL script to make the changes to all the files. A simpler, more elegant and flexible solution in this situation is to keep the information in a database, and generate the HTML documents from this database as needed.

The Syndesis Pages
The new Syndesis Engineering Student Organization pages (see page 16, New Engineering Student Organization Pages) are an excellent example.

The necessary "pieces-parts" are:

  1. an HTML file (the top page from which information requests are generated)
  2. the database (in comma-delimited text format)
  3. several templates used in returning queried information
  4. and the CGI query program CTQuery (CT is short for Comma-delimited Text)

The templates are HTML files containing all the text and tags that surround the actual database information, along with special markers to indicate to the query program where and in what form to insert the data. The concept is very similar to a "mail merge" in a word processor. The top page, instead of containing links to the individual HTML files, contains links that call the CGI query program to display the requested information using a particular template.

Advantages
What are the advantages to using this kind of system? First of all, updating it is greatly simplified, requiring only the uploading of the updated database. There is no need to edit many individual files. If you want to change the layout of the information, just edit one template, instead of all the individual files. Also, at the cost of only the additional disk space of another template you can present the information in a second format. This allows you to, say, accommodate text and graphic browsers with only two template files, instead of two sets of tens (or perhaps hundreds) of HTML files.

Efficiency And Performance
The overall disk space savings can be quite large. In the case of the student organization page the database, executable and templates occupy less than 100K, but are capable of generating close to 300K of unique HTML documents. If the database (presently around 50K) were twice the size this efficiency would get even better: roughly 600K from 150K. What are the costs for generating on the fly? Minimal, provided the database isn't extremely large. The CTQuery program uses less than 100K of memory and generates most queries in under 100 milliseconds on a Sun Ultra.

Improved Access To Information
Easy maintenance and space savings are not the only benefits. You can easily provide viewers with routes to the information they seek. For instance, while the old student organization pages only provided an alphabetical index of all the organizations, the new database-based system takes advantage of information in the database to generate many other indexes. From the front page, users can not only click on a link to generate an alphabetical index of all the organizations, but links are also provided to generate indexes by school, and a form allows them to find organizations by the keywords used to classify them in the paper publication. Databases are also easy to search. This gives users yet another quick way to reach the information they seek. There was no way to search for a student organization by name (other than reading down the list) under the previous system, but now a small form in the top page allows the user to do a sub-string search of organization names as an alternative way of finding the desired information.

Is a database the solution of choice in all situations? No, but for organizing some kinds of WWW information it offers the webmaster the opportunity to simplify the maintenance process while improving the user's access to information.


webmaster@ecn.purdue.edu
Last modified: Tuesday, 09-Sep-97 18:09:18 EST

[HTML Check] HTML