Question:
Dear Dr. Website:
Hi, I am a novice Web developer. I know Perl is the scripting language used in writing CGI, and that all CGI files must have .cgi extensions. But why do some books I've read have CGI programs ending in .pl? Second, for .pl programs, you need to compile, and this does not go through the server, right? But CGI (Perl) programs do, correct?
Answer:
You have come close to answering your own question! CGI stands for Common Gateway Interface, and it's simply a way to allow programs running on a server to interact with a user working on a browser. CGI programs can be written in virtually any programming language.
Perl is frequently used not because it's mandatory, but because it's a good all-around language for this kind of work, and, being freely available, it will run on almost any server. The file extension for Perl is .pl, so if a CGI program is written in Perl, either that or .cgi will work.
However, do note that Perl is actually not generally compiled at all, but
interpreted, which means changes that happen to Perl programs immediately
take effect. There are Perl compilers available, however.
Please visit the CGI pages at
http://webdeveloper.com/categories/cgi-perl/index.html
and
http://wdvl.com/Authoring/CGI/ for more information on CGI programming, as
well as our own FAQ page.
--Dr.Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Question:
Dear Dr. Website:
Hello,
In your column, CGI was described as a programming language. I thought it
was a directory to put programs in. Could you talk about what CGI is? And
what are shells?
Thanx
Answer:
Well, CGI is a directory...to put CGI programs in. The directory is
usually named "cgi-bin," and developers place their CGI scripts within
that directory so that the server can execute a script when a Web page
calls it. There is actually no language called "CGI"--as we wrote in the
column you're referring to [Sept. 28], CGI scripts can be written in
different programming languages, such as Perl or C++. CGI simply stands
for Common Gateway Interface.
Shells are found on most beaches. Sorry, couldn't stop ourselves.
Actually, shells are kind of like "flavors" or specific user interfaces,
for a Unix system, such as Korn, Bourne and C shell (yes, it's actually
called the C shell). These shells enable users to create "scripts" using
the shell's language, or simply issue commands to the Unix machine. Some
people use the word "shell" to refer to any command-line interface with a
scripting language, on any operating system, even Windows (via batch
files).
Thanks,
--Dr.Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Question:
Dear Dr. Website:
I have seen one or two sites with backgrounds that stay in the middle of
the screen regardless of any scrolling through the page. How is this done?
Answer:
You add an extra property to the BODY tag, like this:
<body background="images/bkgegypt.gif" bgproperties="fixed">
Thanks,
--Dr.Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Question:
Dear Dr. Website:
Is there HTML or JavaScript code that can change any or all of the link colors anywhere within a single HTML page? I'd like to use light-colored links on a black menu panel and then change them to dark-colored links on white for the content area.
Answer:
You can try this:
Neither JavaScript nor HTML, but Cascading Style Sheets to the rescue. All
you have to do is something like this before the first area:
<style>
A:link { background: black; color: white; }
A:visited { background: black; color: yellow; }
A:active { background: black; color: cyan; }
</style>
and like this before the second:
<style>
A:link { background: white; color: blue; }
A:visited { background: white; color: red; }
A:active { background: white; color: brown; }
</style>
--Dr.Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~