This is CMC -> Lars -> Professional -> WWW-HTML -> webpro.htm

More Complex Web Programming

All the examples on the previous page were simple static pages, i.e. pages that you write once, the description of the page is in a single text file, and every time you bring up the page, it looks the same. This type of web site is fairly simple to build, and for many people, this is all they ever need to know.

But static pages have their limitations, and in the following we will show you some way to go beyond those limitations.

Server-side #include files: .shtml

When you build a large website for a business, you need to To maintain a unique and uniform look on all pages, typically involves putting 10-20 lines of HTML at the top and bottom of every page. This can be done in two ways: The advantage of using the PERL wrapper is that you can preview the files from your local hard drive. When you use server side includes, they only work when they are being served by a web server. And there are servers that do not support server side include files for personal websites under non-business accounts (because they need a technical reason to justify charging $100/month for a business account instead of $20/month for a personal account).

Server side includes also allow you to do a few other nifty tricks, such as generating HTML from PERL scripts embedded in the page.

CGI-BIN scripts

Web pages do not have to be static pages that always look the same, they can also be the output of a program that runs every time you call up the page. This can be used to implement many kinds of programming applications from online shopping to discussion groups.

As always, when you go from writing text files to writing programs, you are increasing the level of complication, and you are now taking on responsibilities of debugging your programs. Because errors in programs might take down the whole webserver, many server sites do not allow users to put in this kind of programs.

This type of programs are called CGI programs. CGI is short for Common Gateway Interface.

Bulletin boards/discussion groups
http://www.chem.hope.edu/~discus. Generally free (read their license info).

Cookies

In general, displaying a web page is a simple command-response handshake.
  1. The user requests a page named "http://www.somehost.com/page.html"
  2. The browser connects to TCP port 80 (http) of the server "www.somehost.com" and says "Please give me the page named /page.html"
  3. The server returns the HTML file of the page.
If the user wants another page, it is a new request and may in fact be served by a different copy of the server program (and the server may have answered requests from 20 other people in between).

Cookies are a way to pass information about a user between the several server instances that may be talking to the user. The server stores a short piece of (possibly encrypted) text to the browser, and when the browser connects again, it passes the text along with the page request.

For more information about how cookies work, read this article.


  $Log: webpro.htm,v $
  Revision 1.3  2001/10/26 13:28:29  lars
  Replaced CMC -> Beagle-Ears

  Revision 1.2  2001/01/15 07:06:31  lars
  *** empty log message ***

  Revision 1.1  2000/08/25 19:26:58  lars
  Add reference to article about cookies.
  Remove bad link on "spectacular websites" page.