STEPHEN B. JENKINS
offline program-
matic generation
of Web pages
Stephen is
the senior programmer/analyst at the
Aerodynamics Laboratory of the Institute for
Aerospace Research, National Research Council of
Canada. For more information, see
http://www.erudil.com.
Stephen.
AS PROGRAMMERS, WHEN WE NEED
to pr
ovide Web-accessible information, two
methods usually come to mind: a static
one—creating Web pages in an editor or
Web development tool, and a dynamic
one—creating CGI programs to generate
HTML. There is,however, a third, often over-
looked, option: offline programmatic genera-
tion of Web pages (OPG). By OPG, I mean
writing programs to generate HTML docu-
ments at the time and location of your
choosing, as opposed to CGI programs,
where the pages are generated at access
time on the computer hosting the Web
server.
When to Use OPG
While it may appear, at first glance, that OPG has little
to offer over the other two methods, this is not the
case. Its primary advantage is that complex HTML
documents can be quickly and easily modified, with-
out the need for CGI programs. This is an absolute
necessity for people using the services of many of the
largest ISPs, since those companies typically only pro-
vide a small number of “canned” CGI scripts (e.g.,
formmail) and do not allow user-written programs.
Even if you do have complete access to your Web
server, OPG offers a significant benefit in performance:
Web pages can be generated at times when CPU and
IO loads are low. This can be especially significant for
large Web pages that take a considerable time to gener-
ate, such as log file summaries. Rather than create the
documents on demand, as CGI pr
ograms do, the pages
can be generated once (e.g., each night) via a crontab
entr
y
. This is also useful for information that is rarely
modifi
ed (staf
f email addr
ess, phone lists, etc.). The
Web pages only need to be generated as often as the
data changes.
The third place that OPG makes sense is for pages con-
taining large/multiple tables of data. Even if the infor-
mation is allegedly unchanging (we’ve all hear
d that
before!), creating and modifying large tables by hand
can be tedious and error prone. Also, as programmers,
many of us would rather spend the time writing code
to perform a task rather than do it manually.
One fi
nal issue is security. While CGI programs can be
made as secure as any other software on the Net, inex-
perienced coders can inadvertently leave themselves
open to malicious attacks. For the war
y (and the
6 ;LOGIN: VOL. 29, NO. 5