CGI Programming by Collin Forbes
  Using and linking to the Calendar   Updated: Thur, 20 Apr 2000  

Specify which configuration file to use via the URL
calendar.cgi figures out which configuration file you want to use by looking at its URL. If the program can't find the file you asked for, it will fall back to the default filename you hard-coded during installation.

To tell calendar.cgi to use a particular file, take the relative URL path of the file and insert calendar.cgi's URL before it. Thus, if you installed the program as "/cgi-bin/calendar.cgi" and your file is "/calendar/config.txt", you'll call the program as "/cgi-bin/calendar.cgi/calendar/config.txt".

Now add links from your web pages to calendar.cgi. You can either write a form to run the program or encode the necessary information into the query string of the URL and make a link. Two inputs control the month and the year shown:

month

Which month to display. You can say "current", "next", "previous" or give the name of the month, ie "June". The default is the current month.

year

The year of the displayed month. Use the full four-digit year, ie "2000". The years 1970-2049 are supported, and "current", "next" and "previous" also work. The default is the current year.

Here's an example of the kind of form you might want to use:

<FORM ACTION="/cgi-bin/calendar.cgi/calendar/config.txt" METHOD="GET">
<SELECT NAME="month">
<OPTION VALUE="">--Month--
<OPTION>January
<OPTION>February
<OPTION>March
<OPTION>April
<OPTION>May
<OPTION>June
<OPTION>July
<OPTION>August
<OPTION>September
<OPTION>October
<OPTION>November
<OPTION>December
</SELECT>
<SELECT NAME="year">
<OPTION VALUE="">--Year--
<OPTION>1999
<OPTION>2000
<OPTION>2001
</SELECT>
<INPUT TYPE="submit" VALUE="show">
</FORM>

Here are some example relative URLs, with the values encoded:

/cgi-bin/calendar.cgi/calendar/config.txt
/cgi-bin/calendar.cgi/calendar/config.txt?month=April&year=2000
/cgi-bin/calendar.cgi/calendar/config.txt?month=next&year=2000
/cgi-bin/calendar.cgi/calendar/config.txt?year=next