In this Tutorial you will build an HTML database application, that demonstrates key features of Sapphire/Web. Once you have completed this tutorial, you will understand how to:
mkdir tut3Change your current directory to the new project directory:
cd tut3Copy HTML files to your project directory:
cp $SAPPHIRE/tutorials/tutorial3/html/* .Start Sapphire/Web: saweb tut3.pj &
We are going to create a file, by creating a data object, using the Object Editor. We will be able to read this file from the disk, on the machine that the HTTP server is running on. The file will contain a list of names, which will consist of two columns (first name and last name). The actual name of the file on the disk is going to be gbook.txt.
Now that we have created the guestBook File data object, it will be easy to write the append version of the file object. A file object with a mode of append allows you to add data to the bottom of a file. Since we already defined the delimiters and the column names when we created the guestBook data object all we have to do is change the File Mode to append and save the data object to a new name.
The first binding that you are going to create will be defining what happens when you press the SignBook anchor in the index.html document. When this anchor is pressed the CGI will play the signbook.html template. There is no dynamic data on this page so we will use a NULL data object.
The first alias we are going to create will cause the SignBook Anchor in the seebook.html document to execute the same code that is called when you press the SignBook Anchor in the index.html document. As you may remember, the SignBook Anchor shows a Form for the User to enter a name.
For example: if the value of the Test.HTML Path option is /usr/users/jdoe/public_html, a user would enter the command "chmod 777 /usr/users/jdoe/public_html" at the UNIX prompt:
If you do not want to allow everyone to write to the directory to which your Test.HTML Path points, you need to create a file in that directory and give every user write access to it.
For example:
If you did not make any mistakes in the above steps your HTML browser will come up with the HTML Startup Document for the project, which is index.html. You will now add names to the Guest Book to test the project.
#name, type[, remove_previous]#
Type #title,no_wrap# into the Command-Line text field.
#title,wrap#