Images on this site were compressed using e-Vue MPEG4 technology in 2001, which was groundbreaking at the time for its DRM component and higher compression than JPG, however e-Vue is no more we are transitioning these images to JPEG for 2004.
I
often remark how much I like that IBM commercial on television with the Web
designer who is offering the client two big choices for his site:
the spinning logo or the flaming logo, but the client wants actual
interaction, to which the designer replies, "I dont
know how to do that."
(Editor's Note: if you read all my Web Works features, you'll find I last mentioned this TV commercial in Sept. 2000, in my article on how to add "plug-in" portal features to your Web site without knowing any programming.)
In a nutshell, that has been the purpose behind this series of
Web Works articles: making the unknown known. So many Web "designers"
never take the next step into becoming "developers"
because they think they cant get past the big hurdle of
using CGI (common gateway interface) scripts, assuming they must
become hard-core programmers, which might take away from their
"creative" output. Guess what, you can "do that."
A Few Easy Pieces
The main secret of CGI scripts is that once you understand a few
concepts, the rest just falls into place. Assuming you already
understand how to make an HTML page, and know how to upload your
files with an FTP application (meaning, using something like CuteFTP,
WS_FTP, or NetFinder), the next step is easier than you think.
Ideally, you should also have some experience looking at the raw
HTML code, vs. working exclusively with a WYSIWYG Web design program.
And if youve never uploaded a file with an FTP application,
then the rest of this article might be confusing.
Well start with the fundamentals, then end with examples.
First, you must understand that essentially HTML does not have
any built-in interactivity. In the simplest example, even when
you submit a form on a Web page, the information is being sent
to a "form handler," which is a simple CGI script that
takes the information sent from an HTML page then does something
with it, usually connecting to a mail script and E-mailing the
form fields to somebody, and possibly showing you a "thank
you" page. If you understand that the HTML page is not actually
doing the real work, then youve moved one step forward.
Figure 1: Chart showing typical Web page content path.
If you look at Figure
1, youll see a rough example of the path you can take from
a Web browser (e.g., Netscape or Internet Explorer) to seeing
content. In one example, shown in green lines, you might start
on a Web page, which then connects to the Web server, talks to
a script, then sends back information either by creating a new
page based on the information sent or a choice made, or simply
spits out some kind of response like "thanks." In another
example, shown as red lines, you might go to a location on a Web
site, where you never actually load any content from an HTML documentmeaning,
youre starting out by talking to a script that is building
a dynamic page and sending you a generated page based on template
and other content. Shopping carts are typically the latter. You
might start with "click here to shop" and from there
everything you see is being "built" for your browser
screen by a script (or scripts) and not static HTML pages.
CGI scripts, collectively, come in many flavors and languages
like PERL, PHP, Python, and the like. PERL is one of the most
popular because its been on UNIX since the beginning, and
most scripts that work with UNIX, also work on Linux, and can
even be modified to work with Windows NT. For the purpose of this
article, we will be using the most common professional application:
PERL scripts running on a UNIX/Linux Web server.
There are three essential things you must learn to use PERL: