Introduction to cgi scripting

written 19 July 2003 being revised May 2006
Google site search

ContentsIntroductionBasicIntermediateAdvancedFuturePolicyInfrastructure

1   Introduction

cgi scripting is probably the most important area of computer programming today. Multinationals do it, individuals do it. It is the one thing you need to learn to become an active participant in the world wide web, rather than a passive user.

This project is structured as a 6 week course of one 2 hour session each week and is suitable for Y9- or nightclasses. For school age students with more limited concentration span the 2 hour slots can be split into 1 hour.

1.1   Unit DOC

<unit prefix='webscool' catalog='.0' name='Introduction to scripting' >
    <agerange from='13' to='*' />
    <classsize>5-10</classsize>
    <prerequisisteList>
        <name>Introduction to computers</name>
        <name>Word Processing Level 1</name>
        <name>Using the web</name>
    </prerequisisteList>
    <instructiontime>12 hours </instructiontime>
    <homeworktime> 24 hours </homeworktime>
    <abstract>
    </abstract>
    <courseprep>
    </courseprep>
</unit>

1.1.1   Prerequisites

Students must have basic computer skills. Be able to use a simple text editor, a web browser, and be able to download and install software (such as tcl, sambar). They should also have a computer at home and an ISP connection and a commitment to write cgi scripts after the course, in the form of having some personal project they want to complete.

Knowledge of <html> is not assumed as this is probably the first time students will have a need to know how to write <html>.

1.1.2   Conditions of attendance

The course involves completing a project which will be published as open software. Students must agree to participate in the project and permit the project to be published as an open source appilaction.

1.1.3   Preparation for the course

Students must submit an outline for a project that they would like to complete. The teacher will select one of the submissions as the project to be implemented in the later part of the course.

Also students write their own webpage after the first Lesson, so they should bring to the lesson a txt file of the content of their webpage(s) plus any images they need for it on floppy disk. For the webpage choose a topic that is of interest to yourself which represents recent experiences and which will be of relevant interest to others. Examples are:

All of these topics can be illustrated to help bring then to life on the webpage. The text should be brought to the first class on a floppy disk or memory card.

2   What is programming?

In this course we learn two computer languages. The first is xhtml which is called a markup language. Markup languages are a type of language which describes how we want things to look to the reader, simimlar to the markup language you use when editing a document for publication. You specify margins, paragraphs etc. The second language is tcl which is a scripting language. A scripting language is a special type of programming language that is easy to use for simple projects, though scripting lnguages are not as efficient as compiler languages such as C. These are all languages which "make" new things rather than simply modify appearance.

It may seem that the correct order for the course is to do the "making" first and then attend to the appearance, but here we must also "make" the appearance, and we need to know what xhtml language we need in order to get the reseult we want and then use tcl to create it. So first we start by learning to use xhtml. Then we go on to learn about tcl.

3   Lesson 1 - xhtml

text "cgi scripting involves getting information from a form submitted by a user on a webpage, processing that information and replying to the user with a new webpage. The new webpage sent to the user must be written by hand by the cgi script. While there are means to avoid writing the actual xhtml code the scripter must still have a sound understanding of xhtml and this comprises the first lesson in which students write their own webpage by hand.

3.1   XML, xhtml and html

<html> has a history which has developed over the last 10 years from something idiosyncratic, through to piecemeal and towards systematic. This trend is progressing because of the huge investment being made in <html> all over the world. This move to a more systematic and cohesive form of <html> is reflected in the structure which has now developed over <html>. This is in the form of XML and xhtml. The origanl form of <html> has now been generalised into a more general language for describing the way information is structured and communuicated, this is XML. XML is far more rigorous than the original <html>, so <html> has been resticted to conform to the rigour of XML by meeting it in the form of xhtml. xhtml is the rigorous form of <html> that conforms to XML.

Why is XML important ? Organisations want to use more varieties of display method for their different kinds of data over the web, than <html> provides for. As we shal see <html> provides only 2 complex structures, table and list, for displaying structured information and fitting your information into these structures can be a lot of work. Organisations now want to be able to consistently handle their information in many different different environments and <html> poses insurmountable poses management problems. Now companies want to invent their own display structures and be able to communicate these to everyones webbrowsers. XML is the framework that allows this to happen.

In addition to this is the fact that xhtml is used as "content" by more than just webbrowsers. Clients for the blind (audio and braille) present html in a form stuiable to their audience. An audio client has to present the contents of a list or table in different ways to a webbrowser, but uses the same html to do the job.

We do not need to know about XML to do this course, but we use xhtml as a matter of course. Today, people want to be able to extract information from a webpage. This requires that the webpage be written in an easily recognisable form that software xan process. Tcl itself has an extension which can retreive structured information from a webpage, but the webpage must be written in xhtml. On the other hand if you want to protect your webpage from this kind of operation then by all means use non-standard <html>.

To sum up xhtml is the resticted flavour of <html> which conforms to XML and which can be accessed by XML tools.

Because xhtml has to fit into the overall structure of XM, xhtml has to distinguish itself from other types of documents such as library catalogue entries, paper abstracts, maths formulae and a growing variety of other document types which are now emerging. The old style <'html> never had to bother with these issues, but we now have to. This is because we are now working in an environment where XML is becoming the norm and where we want to use the benefits of XML ourselves.

3.2   HTML tags

HTML stands for Hyper-text Markup Launguage. This is a language which is used to edit text, indicate where paragraphs should be, spacing of the text, columnation and so on. You may have learnt written forms of a mark-up language if you were writing material for publication, correcting proofs etc. HTML is a language with a similar purpose but rather than making indication around the text, in the margins and between lines on the page, HTML is special text that is embedded in the text that you wish to publish. It is written in the form of tags which have the following form:
<tagname . . .>
Tags can be inserted anywhere in the text, even between the letters of words. The < and > are unusual characters which have been chosen do represent the tags because they seldom are used in ordinary text. If you do want to use a real < or &gr; you should use the html special representations for these characters &lt; and &gt;.

Tags come in two types, element and block. An element is a single tag, but a block tag encompasses a section of text. The end of the section is indicated by an end tag. The end tag for any tag looks like this:

</tagname>
Some tags always enclose text and must have end tags. Some tags can be used as element tags or as blocks tags. XML requires there to be an indication of the end of a tag. For element tags we do this in xhtml by ending the tag with />. This slash at the end is like the slash in the end tag of a block type tag. So we have two knds of tag:
<element-tag . . . />
<block-tag . . .> Your text in here </block-tag>
With the tag, where the . . . are you can write information that gives more detail about the type of editing you want for your text. This information takes the form of a list of options with their values. if you want the colour to be red you might say color='red'. Notice the use of the = sign. There are no spaces on either side of the = and you must put in the ' around the value. The main purpose for the ' is to include any spaces so that part of your value is not taken to be the start of another option. Even if the value has no spaces xhtml requires that the pair of ' be there.

These are the rules for the way you write tags. As for the actual tags you write in xhtml there are quite a number available and we shall use only some of them in this course. However we shall cover all the most commonly used ones and all the ones you need to know to get the job done.

3.3   Structure of an xhtml page

An xhtml page is itself a specially organised kind of infornmation. It is the text you want displayed and instructions for how this is to be done and how this is to be handled by a users webbrowser. The xhtml is divided into two main sections. The first tells the webbrowser about the page and how it is to be interpreted by the user, and the second part is what to display. The general form of an xhtml page is :
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html 
     PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
     'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<title>The title of your page - this appears in the title bar of your webbrowser</title>
</head>
<body>
You put your text here
.
.
.
</body>
</html>
This general framework has an XML header followed by the xhtml page proper. The XML header consists of two lines.

The first line specifies the version of XML which is being used (there is only 1.0 at this time) and the character set to be used for this data. UTF-8 is the usual character set for romance languages and includes most of the accents requried by Spanish and French though maybe not Swedish.

The second line, which runs over three lines here, tells the client program (not necessarily a webbrowser these days) that this is going to be xhtml which conforms to the transitional standard. The transitional standard is a version of html that is tolerant of <html> tags that are now considered obsolete. In addition to the transitional standard there are two other standards, the "strict" and a standard that permits framesets to be used. The specification for these is:

<!DOCTYPE html 
     PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
     'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
and
<!DOCTYPE html 
     PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN'
     'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
You use the strict form when you want to ensure that your xhtml can be processed by other programs. You use the frameset version only if you have frames in your page.

The xhtml page above has 4 tags in it and they are all block tags. The html tag frames the whole page. The <head> tag frames the section where we tell the browser special information. The <title> is required and tells the browser what to put in its title bar. This is all the information that you must in clude in the head section. Then comes the text body of the page within the </body> block.

In fact the html, head and body tags can be left out but this is not done as it seems to confuse people (but not computers). It is important to write xhtml that you and others can understand clearly if you are writing scripts.

The above example is a correct xhtmlpage and you can check this by copying it into a file and giving it a filename ending with .html. When you double click on this filename the page should display in your webbrowser. You use this basic framework for all your webpages.

The rest of the tags described here are ones we use in the body to describe how you want your text to look.

3.4   Inside the Body

There are many tags defined for use inside the body. Some allow you to change the way your text looks. Some allow you to arrange your text on the page. A third group of tags are used to allow the viewer to provide information to the computer. This last group are deiscussed later. For now, here are the tags in the first two groups.
Tags for changing the look of text:
<b>
bold face
<em>
emphasis - usually expressed as bold face
<i>
italic
<font>
Has attributes size and color which allow you to adjust the appearance of the text. This tag is deprecated in favour of the style attribute in other tags which uses the cascading style sheet (CSS) definition. But since CSS is beyond the scope of this course <font> is used here.
<pre>
Displays exactly what you type, without space compression, line readjustnment etc.
Tags for organising text on the page:
Lists
Unordered lists <ul> and <li>, ordered lists <ol and <li>, and data definition lists <dl> with <dt. (data term) and <dd> (data definition.
<br />
Line break
<p>
Paragraph
<hr />
Horizontal ruler
<div>
Divider
Table
<table> tag with table row <tr> and table data <td> tags.
First we look at some simple tags that make your text look different, for headings, and for bold and italic fonts. These are all block tags that enclose the text you want to edit.

There are 6 heading tags <h1> through to <h6>, ranging from largest to smallest. The browser places headings on a line of their own. If you want to have something else alongside your heading you need to either put your heading in a table, which is covered shortly, or change the way your text looks using some of the other tags. <h3> your heading</h3>
looks like

your heading

The two other commonly used tags for altering the appearance of your text are for bold and italics. These are the <b> tag for bold and the <i> tag for italics. These are both block tags but they can be put around a large amount of text or a single letter and do not break up the text the way heading tags do. Bold looks like this while italics looks like this and you can wrap one around the other to get this. To do this properly the tags must be nested which means that the end tag for the first tag should come last like this <i><b>this</b></i>. This nesting rule aapplies to all tags.

There are three tags which are commonly used to space out your text and create paragraphs. these are all commonly used as element tags, though the paragraph tag can be used as a block tag for special effects.

The paragraph tag <p /> inserts a blank line in your text. It does not do the indentation you may be familiar with in books. The break tag <br /> just starts your next bit of text on a new line. This is useful if you want to display a simple list without any special features. The <hr /> tag inserts a horizontal rule across the page and starts you text on a new line. This is useful if you want to clearly mark sections in your page, but is more often used to organise the look of information in lists or in tables.

These are the basic tags for modifying the look of your text, but xhtml has many more tags which allow you to make your text appear in special ways. You can look up reference material to check up on these but they do not tend to be used in cgi scripts. The reason for this is that they are used for special kinds of situations. When you write scripts you use the scripting language rather than tags to do what you want as you have more effective control using your own methods.

There is one text formatting tag that covers most of what you will ever want to do as it provides a wide range of options for you to specify. The <font> tag is a block tag which allows you to change the size color and font of text. This tag is now deprecated which means it should no longer be written, how ever no simple alternative to it has been provided so I include it here. In later lessons I will tell you how not to use the font tag. The font block tag can be used to adjust the typeface or your text using the face option, the colour using the color option and the size using the size option.

Using the face option is difficult because you only want to specify a font which you can be sure the reader of your webpage has on his machine. there are five standard font types which web broswers must be able to cater for, serif, sans-serif, cursive, fantasy and mono-space. Many browsers use serif for cursive and sans-serif for fantasy. So you tend to get Times used for serif and cursive, helvetica for sans-serif and fantasy, and courier used for monospace. If you want to be more specific than this then you should use a list of fonts ending in one of the five standard types. If you want to use Arial instead of Helvetica use an option like face='arial,sans-serif'. If the browser does not have the typeface you specify it uses the fall-back style.

The colour is specified using the color option. You can scify most any word for a colour and the browser will know what you mean because it has a huge list of color names to chose from, but you dont want to misspell it. But when you are scripting you usually want the colour to signify something special and to be used as a variable in your script so that you can change it in just one place in your script and all occurences on the webchange will be changed together. You can still use coour names but you tend to use the hexidecimal codes for colours. The hexidecimal code starts with a # and is followed by 6 characters, 2 for the red component, 2 for green and 2 for blue. Each pair of characters allows for 256 steps in the colour gradient for each component, but web browsers usually only cope with 6. They are 00 for none , 33, 66, 99, aa and ff which is full saturation. #ff0000 gives you red, #00ff00 green and #0000ff blue. #999999 gives a mid grey, #000000 black, #ffffff is for white. If you understand a little about additive colour it should not be difficult to work out what you want. Remember, this is not like mixing paint, yellow and blue does not make green, in this case it makes white.

Finally there is the size option. You can specify and absolute size from 1 through to 7. The normal is 3, but today many webpages make everything 2. On some browsers the user can adjust everything bigger or smaller by using the View option on the menu bar, but some browsers may be too simple for this. The more useful size value is the relative change where you can specify -1 for a little smaller, or +1 for a little larger. and the same for +2, +3. This means that if you decide to change your font size, the relative changes will follow through, otherwise they might get merged with your overall change and the effect lost.

Adding all this together we get some examples of the use of the font tag.
<font face='verdana,sans-serif' color='#ff9900' size='+1' > becomes this
<font face='brush455,cursive' color='#00aa99' size='+2' > becomes this.
It should be a very cursive typeface but is probably not.

In order to ensure the a special typeface is used fopr special effect an image of the word is put in the page instead. This is a topic for later.

There are two methods you can use to structure information in xhtml, list and table. List is the simplest. <html arranges each item you want in your list in seperate lines down the page. There are three kinds of list depending on the kind of indentation and labelling you want for your list. The list consists of a block tag for the list which encloses the whole list. There is <ul> unordered which produces a simple indented bulletted list, <ol> ordered which produces an indented numbered list for when the order in which things are done needs emphasis, and the third kind id the definition list <dl> which you use when you have term-description pairs.

The unordered and ordered lists have a block tag <li> for each item in the list. The definition list has two block tags, one for the term <dt> and one for its description <dd>. The description tag should follow the term tag of course. The deifintion list can be used for writing a script for a play or for displaying diary entries.

The most used structure in xhtml is the table tag. This is a block tag which allows you to arrnge information in the form of a table, but it is used for far more than this. It is used to layout the page, space information across the page, incorporate images on the same level as text, put columns into a page, or to space groups of related data across the page. It is also used to lineup related items down a page. In short it plays a part whereever you want to control how information is placed on the page.

A table is specified using three main tags, all of which are block tags. The first is the <table> tage which indicates the extent of the whole table. This tag has a number of options which allow you to control the way it is placed on the page, its border , its spacing and its colour. next is the row tag <tr> which specifies the beginning of a new row across the table. The data tag <td> specifies each cell across the row. Within the table the cells across are all aligned along the same column boundaries, which the web browser calculates. This creates an orderly grid. You can have as many tables as you like on a page and you can have table set within tables. This provides you with great flexibility for laying out your page.

The table tag has a number of options, most of which you use at one time or another. The two most important adjust the spacing around the cells in the table and within the cells in the table. The cellspacing option says how much space you want around each cell, while the cellpadding option says how much space you want around your text within each cell. There is not much difference between these two unless your cells have background colours. If you have cellpadding=0 then the text will appear crowded at the edge of the cell. the border option is used if you want each cell to have a border around it. If you have cellspacing=0 then you will get a single line between cells, but with more than 0 you get seperate borders around each cell creating a double effect. These three options can be adjusted for a variety of presentation looks. These options can be further developed using the frame and rules options. The frame option specifies which part of the table border is displayed, and the rules option specifies to what degree the cells have borders around them. The HTML 4.0 specification has more detailed information about these options and how to use them. The width of the table can be specified by using the width option. the width can be an absolute width in pixels or a % of the window width such as width='80%'. It is best to use percentages as these are more independant of the users window size. It means if he narrows the window, he will still be able to see all the text on the page. Lastly, the background colour option, bgcolor, allows you to specify a background colour for a table. This is often desirable in order to show how the text is organised on your page. In particular forms that are to be filled in benefit from having a pale background colour to highlight them. The bgcolor option is another deprecated option which has not been replaced within xhtml and so it is mentioned here. THe better way to specify background colour is within style sheets, but that is another story.

When the browser comes across a table, it uses the first row of the table to calculate the number of cells across and what spacing it should use. This means that the first row should have all the cells across that the rest of your table is going to use. Its possible that your first row doesnt need to use all the cells across, so you can either put in some empty cells or you can use the colspan option in a <td> tag to say that one cell is intended to span across a number of columns. Using the colspan option prevents boders appearing where you dont want them. The <td> tag can also have a rowspan option which does a similar thing down rows. Combining the two can be quite tricky, but effective for displaying loosely grouped information over a common background such as a map. The table data tag also has a background color option. You often need to adjust the waty that text appears in a data cell by specifying the horizontal alighment option, align, and the vertical alignment option, valign. The default is to left justify text and position the text halfway down the cell. If the cell contains numbers you will want to right justify them using align='right' or you may want the text to fill out to bnoth sides of the cell by using aling='justify'. Often you want the text to start at the top of the cell rather than part way down. You do this by saying valign='top'.

It would be nice to say that the xhtml definition document quoted above is a good example of how to use xhtml, but unfortunately it does most of its magic using style sheets, which are too complicated for a beginners course.

To round out this introduction to xhtml there are three more tags.

The div block tag is useful for bracketing a portion of your page. In particular you can use the align option to justify tables or lists in the context of the page. Using <div align=center > your table or tlist here </div> will center your text across the page.

Everyone wants to include images on their page and you do this using the image element tag <img ...>. You need to use some options with this tag to say where the image is to come from, the src option, and you should also provide a subtitle for the image, the alt option. This can include a title for the image any copyright info or other details which are appropriate. The alt option information appears when the mouse is over the image. sually an image is not the right size for your layout. Rather than changing the image size on your computer you can adjust the size of the image the appears on the webpage by using the width and height options. these specify hieght and width in pixels. If you specify just one of these options the image will be scaled in both direction to the height or width you ask for. If you use both option it will be forced to fit yuor options and the image will be out of proportion. This may not be a problem for text headings, but usually is not good for photo images. Although you can size the image on the page you should not refer to large image files on a webpage as they take too long to download. No image should be more than about 30kb in size. Being an element tag, the image tag should end with />.

The last tag isd in a sense the most important. It is the hypertext referral tag which makes xhtml what it is. The tag is called the anchor tag <a> and includes the href option which says what the name of the page is that the user will be presented with by clicking on the link. <a> is a block tag and the text within the tag and end tag is usually coloured and underlined to indicate that it is a hyperlink. Also when you move the mouse over the text the arrow turns into a hand or some other emblem.

This is probably more than enough information to enable you to edit your text file with xhtml tags so that it displays nicely on a web browser.

3.5   Homework

Edit the page text and create an xhtml webpage.

4   Lesson 2 - Guestbook exercise

The goal of this class is to learn enough to be able to add a guestbook to your webpage for homework.

4.1   html form

4.2   tcl commands

4.3   tcl variables

4.4   tcl lists

4.5   tcl arrays

4.6   cgi interface

4.7   tcl loop control commands

4.8   Homework

Write the guestbook application CGI scripting with Tcl

5   Lesson 3 - The Project

The participants in this course will submit proposals for a project. The teaqcher selects a feasible project with best bang-per-buck. Since this exposition does not have this living process available a "pre-selected" project is going to be developed. This is a maths homework system. The idea of this system is that the teacher generates a webpage with maths questions of a certain level of difficulty. Students then access this page, sign on and complete the page form with their name and their answers to the webpage. The answers are then assessed. The answers are also compared to evaluate copying. Also the time it takes to complete the homework is calculated into the final score. Results are stored in a database and a history for each student is developed.

This is far from a simple application. The idea within the homework is that the students can use the computer calculator or any other means they like to get the right answer. The computer does not verify their answer for them so they do not know if they have got it right until the teacher has processed the results. Therefore the questions are graded from a simple level such as simple multiplication like 7 * 8 which students should be able to do in their heads quickly. up to more complicated multiplication division and subtractyion which only some students will be able to do in their heads quickly, such as 30 * 7 / 5. Somehow the participants have to work out what the boundaries are for these level changes and how to program a random selection of questions for a webpage. These "question libraries" can develop to such kinds as how many metres of concrete do you need to order to lay a driveway 40 m long, 3 m wide and 150 mm thick. There are a lot of useful building qustions which relate maths to real life situations and which require comprehension and thought to solve. How do you go about writing the script to generate these questions ? What other levels of question could you attempt to add to this system?

Can you provide an administrative function that allows people to add new types of, or levels of question to the syste,? How would you do that ?

These are all questions for the project to deal with and come up with answers, create a plan, delegate tasks and implement.

5.1   Define transactions

First define the cgi transactions that take place. A form will deliver information to a cgi script and that script will store and generate information and provide a webpage response.

The first obvious cgi script receives the students homework, marks it, caluclates the time (how does it do this?) stores the results under the students profile, compares it to other students results to date and enters a pofile mark for the student. It sends a message received page back to the student but does not say what the mark is because that information might be used to aid other students. This indicates a development of the system, that diferent students get different homework assignments, which may be of a different level if they choose. In other words, the student may request the homework page pesonally, trather than have the teacher set it. This leads to the next feature - that a student may only be able to request homework from a progressive range of levels. The appiclation will keep track of the students progress up the scale of levels. This method also resolves the problem students copying each others answers. So it is possible to tell a student the results immediately.

This leads to the next cgi script - the student sign-on and request for homework. The student accesses an index page for the application and signs-on. The homework engine responds asking if the student wants homework at the same level or at the next level up.

The next cgi script generates a page of questions at the level that the student asked for. It keeps a copy of the questions so that it can be sure that the student has not altered the webpage source to make things easier. This also solves the access time problem. Thuis data is kept on file in the students directory as homework in progress.

The teacher signons on to review the results. A page with a results history for the students is displayed.

the more difficult aspect of the application is how to allow new levels to be added. The idea being that these levels could cover any topic at all, chemical equations or calculations, physics topics and so on.

5.2   Define the common data structures required

This is basically the students results profile. What information is held, and in what form.

5.3   Delegate Tasks

Delegate the tasks of writing the cgi scripts for generating the simplest level of questions, the answer cgi, the login cgi, the level request cgi, the teacher signon cgi and the teacher report cgi. Some of these tasks are small and when a student has finished a simple task can help someone with a more difficult task. Someone should be writing a webpage desfribing the application and someone should be assigned to monitor progress and reassign tasks to ensure the project is completed that week.

5.4   Homework

Write the base application.

6   Lesson 4 (&5) - testing reviewing Improving and Featuring

Students review what has been done, critisie and make a list of changes that need to be made. They prepare a plan for making these changes to the base system. If this appears to be all that can be completed in the next homework round then that is ok. They will have a good base functional system.

It is likely that the students will need to learn more about tcl in order to write the more complex level question modules. this may include regexp, special string commands, pocedures and so on. These topics can all be covered in theis class.

Finally the students need to think about how new modules can be added into the appliaction and the kind of structure that is required for that to happen. After the teacher login, the application may present a panel that allows the teacher to add a new module. This module will need to be tested out by others to ensure that it works properly, that questions get the right answers calculated for them. So the new module will need to be in "test" mode so that only teachers can sign-on and do homework assignments against the module. When everyone is happy the module can be given a level assignment and put into production.

A module will consist of a set of say 20 questions selected at random from a list of such questions. Each question consists of a presentation procedure which generates the question and a corresponding answer procedure which generates the answer. Both procedures have the same arguments, or they could be the one procedure with a switch argument. These procedure can then sit in a file with a level header within a directory of such files. The engine can scan the files for appropriate levels and topics and deliver the requested homework page to the student.

The idea of this application is that anyone can add their own levels over the net, so we need to make these script file accessable via webpage to teachers to write and review and correct. Again we go through the same process of desinging the cgi scripts required and the data structures, delegating tasks and completing the project. As not be necessary to implement extra levels at this stage. Since the system is extendable the extra levels can be added by any teachers later if we provide a friendly mechanism. However as this task covers two lesson periods someone may run out of work and can be assigned the task of testing out the extention to the system with a new level or two.

6.1   Homework

Complete the system

7   Lesson 6 - Assessment and Publication

Again do a critical assessment of the system and the changes that are still needed to be made. Prepare a plan for publication of this application say on tki or of providing it on CD to schools. It will be included in webscool. After all this work students may want to see some monetary reward for a job project and so they should. Publication as open source on webscool does not preclude selling a download of the product. Students can form a partnership or whatever legal body they need to sell a version of the product in NZ and overseas. The product will need a logo and some degree of graphical presentation.

This marks the end of the course.

8   Comments

The homework application is hyperthetical but illustrates the kind of work and problems and program sructure that are required to complete any moderately complex web application. As such it represents a useful indicator of the way in which time may need to be managed in the later part of the course. Of course the actual project chosen will differ slightly.

©2000 - 2006 WEBSCOOL This page last updated 11 May 2006. All rights reserved - including copying or distribution of any portion of this document in any form or on any medium without authorisation. For more regarding the copyright.