written by Ashley Cheng, June 1997
1. What is new in this version?
Information on how to create an image map is updated as IOHK re-configures its Web Server setup.
Some cool things that can be done with CGI programs include on-line database searching, feedback form, image-map, access counter and on-line ordering.
I personally prefer PERL for several reasons: it is a scripting language which needs no compilation before it will run and is easier to debug and maintain than a compiled program; it is optimized for easy manipulation of text, files and processes; it is portable and available in most platforms.
The nph-count program helps you keep track of the number of hits to your home-page by generating on the fly an odometer like counter image and displaying it in the calling home-page.
To activate a counter in a certain HTML-page add something like:
where arg1,2,3 are any of the supported arguments.
Recognised arguments include:
Example: <IMG SRC="http://www.iohk.com/cgi-bin/nph-count?link=cgifaq&width=5>, and the resulting image will resemble the image below:
For a real-life example please see http://www.iohk.com/UserPages/acheng. For more information on the nph-count program, please refer to Frequently Asked Questions (FAQ) about WWW-page Access counter. To learn more about Access counter in general, take a look at Yahoo's Access Count Resource Page
An imagemap is a graphical overview of any set of information resources. By clicking on different parts of the overview image, users can transparently access any of the information resources. For real-life examples, take a look at http://www.wahyan.edu.hk and www.ha.org.hk/qmh.
First step: create an image to serve as the map.
The image could either be in GIF or JPG format. You could use any graphic programs which produce files in GIF or JPG format (e.g. Adobe Photoshop, CorelPhotoPaing etc) that you are familiar with. I personally use Adobe Photoshop 3.05. The image should then be placed somewhere in your home-directory on www.iohk.com.
Second step: prepare the map information file.
This file maps regions to URLs for the given image. IOHK's server uses the NCSA Map file format. Lines beginning with # are comments. Every other non-blank line consists of the following:
method URL coord1 coord2 ... coordn
method is one of the following:
URL is one of the following:
coord#: Each coord entry is a coordinate, format x,y. The number depends on the method.
The map file that the home-page of Wah Yan College used is shown below:
default http://www.wahyan.edu.hk/Welcome.html rect http://www.wahyan.edu.hk/alma/Welcome.html 15,11 229,160 rect http://www.wahyan.edu.hk/oldboys/Welcome.html 256,10 474,158 rect http://www.wahyan.edu.hk/interest/Welcome.html 14,181 229,328 rect http://www.wahyan.edu.hk/news/Welcome.html 257,180 473,329For a list of tools that may help you create a map file, see Yahoo's Imagemap Directory. For example, MapTHIS! is a good freeware WYSIWYG image map editor/creator for those who work under Windows platform.
It doesn't matter what you name your map file but it is customary to give it a *.map extension. After creating the map file place it somewhere inside your home-directory on www.iohk.com. For example, the map file of Wah Yan College (wahyan.map) resides in http://www.iohk.com/UserPages/acheng.
Third step: referencing the map information file from your map image
Example:
Note: It is no longer necessary to include the path "cgi-bin/imagemap" when you refer to the map file as described in the previous version of this FAQ.
That's it!! Now you have an imagemap in your home-page. For more information on Imagemap, read NCSA ImageMap Tutorial.
Note: Certain newer browsers such as Netscape navigator 2.0 and Microsoft Internet Explorer, support Client Side Imagemaps. Check out http://www.spyglass.com/techspec/img_maps.html for more information on that.
IOHK's server has installed a freeware CGI PERL script, FormMail.pl, by Matt Wright which allows you to create any feedback form you wish and then by imbedding certain hidden form elements the results will be mailed back to you.
First Step:
Create a FORM as usual. Include as many fields as you like. For more information on how to create a form, see Yahoo's Form resource Page.
Second Step:
Make a reference to the script from your FORM by specifying it in the ACTION option:
Third Step:
Modify the behaviour of FormMail.pl so that it works for you by adding several HIDDEN fields in your FORM:
That's all! For an example, look at http://www.wahyan.edu.hk/interest/submit.html For more options please refer to this file written by the original author.
This CGI program returns, when execute, a new HTML document which simply contains the current date and time as they are on IOHK's server.
To invoke the program, you could either make reference to it using a link:
or by running it from a FORM:
Below is an example:
This CGI program returns a new HTML document which contains a calendar of a certain month that you specify. You may invoke the program in your home-page by calling:
it will then show you a default page which allows you to enter the calendar you want to show. An example could be found at http://www.iohk.com/UserPages/lcchong/utility.html.
Alternatively, you may specify the month you wish to show as a parameter to the program:
Example: This is the calendar of July 1997
This CGI program helps you query the FINGER server of IOHK and displays the result to you as a separate HTML document. You may invoke the program by calling the following in your home-page:
in which case a default page will be shown in which you could enter the username you wish to FINGER.
you could also pass the query string to the program directly:
Example: Wish to know more about me?
No. Technically it is possible but for security reasons, IOHK's Web server is so configured that only scripts/programs located in a specific directory (which happens to be /cgi-bin in our case) could be launched from a Web Page.
Yes, you may. You are welcomed to submit CGI scripts/programs, that you think are useful, to the Webmaster of IOHK's Web Server for scrutinization. Our WebMaster will consider implementing the requested scripts/programs in IOHK's cgi-bin directory as long as they satisfy the following criteria:
This question is included for completeness sake. If you do wish to find out more about the author of this FAQ, take a look at his home-page. You may also bug him with questions on CGI or other Web-authoring related questions by email.