Version 3.1
User's Guide

Forms Processing Tutorials

Previous | Next
Contents

Forms to E-Mail

This first example will be the simplest. Sending mail with NetCloak Pro is very straightforward using the SENDMAIL directive. This first example will cover the basics of sending mail, and also how to specify a custom response after the form is submitted.

Creating HTML Input Forms

The first step in building all forms processing systems is creating the HTML input form itself. To get started, fire up your favorite HTML editor and create a simple form for requesting information. On your form, create text fields called Name and Phone, and a text area called Message. Label them on the HTML page. When you are done, add a submit button. Don't worry about what it will do– we'll get to that later.

Every HTML form includes a FORM tag which includes an ACTION parameter. When you create any form to be processed by NetCloak, the ACTION must be the URL to the FDML file. For the form you just created, enter "Test.FDML", which is the name for the FDML file we will create in the next section. Don't add a leading slash or any folders or other path information. The FDML file will go in the same folder as the input form, and the browser should process the FORM ACTION correctly. Here is how your complete FORM command should look:

<FORM METHOD=POST ACTION="Test.FDML">

Starting the FDML File

When your HTML input form is ready, save it on the server like you would any other HTML page and open it in your Web browser. You should be able to fill in the various fields, but when you click the submit button, the server will return an error. You are now ready to create the FDML file, which will tell NetCloak how to process the form data.

Using a text editor (not your HTML editor), create a new file. This will be the FDML template that tells NetCloak to send data from the form you just created as a mail message. Start with the SENDMAIL directive, which will specify what mail server to use to send the message, the address the message is going to, the address the message is from, and what the subject is. It should look something like this:

<SENDMAIL "mail.myorg.com" "bob@myorg.com"
"tim@myorg.com">Form Submission</SENDMAIL>

Yours will be different from this because you will substitute your own addresses instead of those that are here.

The first parameter (mail.myorg.com in the sample above) should be the address or domain name of your local SMTP mail server. If you aren't sure of the name or address of your mail server, check the mail server setting of your own e-mail program to find out what it is.

The second parameter is the e-mail address of the recipient of the message. For now, simply enter your own e-mail address. This is followed by the From address, which is the mail account the message will appear to have been sent from. In the sample above, this parameter is set to tim@myorg.com, but for now set it to your own e-mail address as well.

NetCloak Tip: One of the most common problems encountered when using NetCloak to send e-mail is an invalid from address. Many, if not most, mail servers are configured to only process mail from known senders, which prevents spammers from using the mail server to forward junk mail. Unfortunately, this restriction also prevents legitimate mail forwarding. So, you need to be certain that the from mail address is a valid address and that the user specified has an account on your mail server. When in doubt, start by entering your own mail address for this field. Once you have confirmed that mail is being sent properly you can try changing it to another address.

Between the opening and closing SENDMAIL tags is the message subject. You can set this to anything you like, but for now make sure that the subject will be unique and easily identifiable.

The rest of the FDML file is simply the text of the mail message. For now, just type a line of text or two that will let you recognize the message. When you are done, your complete FDML file will look something like this:

<SENDMAIL "mail.myorg.com" "bob@myorg.com" "tim@myorg.com">Form Submission</SENDMAIL>
The form was submitted and NetCloak sent you this message.

Now save the file in the same folder on your Web server as the input form you created earlier, and name it "Test.FDML".

Testing the System

When that's done, go back to a Web browser and open the input form again through the Web server. Enter some information into the input fields, if you like, and click submit. This time, instead of an error message, you should get the generic NetCloak "Thank You" response. Wait a couple of minutes and check your e-mail account... There should be a new message waiting for you.

Debugging SENDMAIL

If the FDML example above doesn't work, you'll need to figure out why. The first possibility is that the server or NetCloak couldn't find the FDML file. If you get a file not found (404) error from the server, it did not send the request to NetCloak and the FDML file was not correct. In this case, make sure NetCloak is working properly and that the FDML is specified correctly and ends with a suffix that will be processed by NetCloak with the "NFORMS" action.

If you submitted the HTML input form and got a "Can't Find FDML File" error instead of the "Thank You" message, then NetCloak received the request but could not find the specified FDML file. Check to be sure that the FDML file is in the same folder as the input form, and check the FORM ACTION parameter to make sure it specifies the exact name of the FDML file you created.

If NetCloak did return the "Thank You" message but you don't receive the e-mail message after 5 or 10 minutes, then an error occurred sending the e-mail. Open the NetCloak Files folder on the server, then open the Failed Mail folder inside it. A text file should be in this folder; open it with SimpleText or BBEdit. It will include all of the details about the message, including the To and From addresses, the message body itself, and an error line that describes what went wrong. If the error message doesn't lead you to a resolution to the problem, send the failed mail file to support@maxum.com and Maxum's support people will help you identify the trouble.

Extending The Example

Now that NetCloak has accepted the form submission and sent you
e-mail, we have a good start. The trouble is that the e-mail message you get doesn't have anything interesting in it. That's easy to fix.

Remember that an FDML is just a template. Whatever message you included in your FDML file after the SENDMAIL command is what shows up in your e-mail message, just the way it appears in the FDML. If you put a blank line between two lines in the FDML file, then a blank line will be included in the e-mail message when you receive it.

Much more useful is to include information from the form in the message. To include any of this in the message, use the NetCloak REPLACE command to insert the field into the e-mail message according to the FDML template.

Your input form has the fields Name, Phone, and Message. To include this information that was entered into the form, add to the FDML file so it looks something like this:

<SENDMAIL "mail.myorg.com" "bob@myorg.com"
"tim@myorg.com">Form Submission</SENDMAIL>
A Message was submitted by <REPLACE Name>
(Phone: <REPLACE Phone>).
Message - <REPLACE Message>

If a user submitted the message form after entering the name John, the phone number 800.813.3410 and a short message, you would then receive an e-mail message like this:

A Message was submitted by John (Phone: 800.813.3410).

Message - This text was entered into the Message field on the input form.

Other commands can also be used to represent the user entered information in an FDML template. In particular, the IF command is very useful. There is more about the IF command in the Guestbook tutorial later.

The new form-to-e-mail system can be extended in other ways as well. In almost all cases you will want to return your own message when a form is submitted instead of the simple "Thank You" message built into NetCloak. This is done with the RESPONSE directive, which is put at the top of your FDML file, along with the primary directive. Here is how the FDML above would be changed to return the page "Response.html":

<RESPONSE>"Response.html"</RESPONSE>

<SENDMAIL "mail.myorg.com" "bob@myorg.com"

"tim@myorg.com">Form Submission</SENDMAIL>

A Message was submitted by <REPLACE Name>

(Phone: <REPLACE Phone>).

Message - <REPLACE Message>

Other directives allow your FDML file to confirm input of required fields, chain to other FDML files to perform additional actions, and more. The other tutorials will explain some additional techniques; for more, read the NetCloak Reference Guide.

Guestbook Tutorial: Adding to Existing Pages

In the previous tutorial you learned how to send mail from a form submission. The next step is to use forms to let users interact directly with your site by adding to an existing HTML page. We will build a simple Guestbook where users can add their name, address and a short comment.

The Guestbook example demonstrates the use of two important NetCloak Pro features. The INSERTFILE directive is used to update an existing HTML document, and the IF command is used to conditionally replace data from fields in the new HTML. It is also a good example of taking data from a user entry and rendering it as highly formatted HTML with IF commands to prevent the creation of broken or malformed links.

The Guestbook consists of three files- AddGuest.html, the HTML form where guests enter information; AddGuest.FDML, which processes the form and adds the new HTML to the third file, Guestbook.html. The file Guestbook.html is the actual guest book Web page.

The initial Guestbook.htm, with no entries, is very simple:

<HTML>
<HEAD>
<TITLE>Sample Guestbook</TITLE>
</HEAD>
<BODY>
Here is a registry of the people who have visited my site...
Why not <A HREF="AddGuest.html">add yourself</A>?
<HR>
<!--GUESTLIST-->
</DL>
</BODY>
</HTML>

The unique feature of the file is the <!--GUESTLIST--> comment tag near the end. This comment serves as a marker where NetCloak Pro will insert new HTML into the document as users submit the form to add themselves to the page.

The entry form in AddGuest.html looks fairly long here, but is otherwise straightforward.

<HTML>
<TITLE>Add Yourself To The Guestbook</TITLE>
<H1>Add Yourself To The Guestbook</H1>
<FORM method=POST action= "/Guestbook/AddGuest.FDML">
To be added to the Guestbook, just fill out this form...
<P>
<HR>
<H3>About You...</H3>
<DL>
<DD><B>Name:</B>
<INPUT TYPE="text" NAME="UserName" SIZE="32" MAXLENGTH="32">
<DD><B>E-Mail:</B>
<INPUT TYPE="text" NAME="EMail" SIZE="32" MAXLENGTH="32">
<DD><B>Title:</B>
<INPUT TYPE="text" NAME="Title" SIZE="32" MAXLENGTH="32">
<DD><B>Organization:</B>
<INPUT TYPE="text" NAME="Company" SIZE="32" MAXLENGTH="80">
<DD><B>Home Page URL:</B>
<INPUT TYPE="text" NAME="HomePageURL" SIZE="32" MAXLENGTH="80">
</DL>
<HR>
<H3>About Your Web Site...</H3>
<DL>
<DD><B>Site Name:</B>
<INPUT TYPE="text" NAME="SiteName" SIZE="32" MAXLENGTH="40">
<DD><B>Main URL:</B>
<INPUT TYPE="text" NAME="MainURL" SIZE="32" MAXLENGTH="32">
<DD><B>Brief Description:</B><BR>
<INPUT TYPE="text" NAME="Desc1" SIZE="60" MAXLENGTH="60">
<BR>
<INPUT TYPE="text" NAME="Desc2" SIZE="60" MAXLENGTH="60">
</DL>
<P><HR><P>
<CENTER>
<INPUT TYPE=submit VALUE="Add Yourself">
</CENTER>
<P>
</FORM>
</HTML>

The form defines a number of fields for the user's name, e-mail address, company name, personal URL, company URL, and other interesting information.

This comes together in the AddGuest.FDML where the raw information is put into formatted HTML. It is a relatively short file, but a lot happens in it.

1) <RESPONSE>"/Guestbook/Guestbook.html" </RESPONSE>
2) <INSERTFILE "<!--GUESTLIST-->"> "/Guestbook/Guestbook.html"   </INSERTFILE>
3) <P>
4) <IF HomePageURL IS# "" THEN "<A HREF=<REPLACE HomePageURL>>">
5) <B><REPLACE UserName></B>
6) <IF HomePageURL IS# "" THEN "</A>">
7) <IF EMail IS# "" THEN "(<REPLACE EMail>)">
8) - <REPLACE Title>
9) <IF Title IS# "" THEN ", ">
10) <REPLACE Company><P>
11) <DL>
12) <DD><IF MainURL IS# "" THEN "<A HREF=""<REPLACE MainURL>"">">
13) <B><REPLACE SiteName></B>
14) <IF MainURL IS# "" THEN "</A>">
15) <IF Desc1 IS# "" THEN " - <REPLACE Desc1> <REPLACE Desc2>">
16) </DL>
17) <HR>

So, what's going to happen here after the user clicks the Submit button?

Line 1 - The RESPONSE directive is used in the other examples, but in this case note that the response file is the same Guestbook.html file that NetCloak Pro is updating!

Line 2 - The INSERTFILE directive contains the <!--GUESTLIST--> marker comment to indicate where NetCloak Pro should insert the new HTML in the page being updated. This must match the comment in the guestbook file. Between the opening and closing tags is the path and filename for the Guestbook.html file where the new HTML will be inserted.

Line 4 - This line creates a link to the user's home page if their URL. If the user did not enter a home page URL, the IF commands will prevent NetCloak Pro from creating a broken link.

Note that this requires two IF statements– one for the first part of the anchor tag, with "<A HREF=" and the URL of the user's home page, and another for the closing "</A>" from the anchor tag (on line 6).

The IF commands are easier to understand if you look at each part separately:

<IF HomePageURL IS# ""

The first half of the IF command has a logical condition; the command uses the # character to specify "not equal to", so the snippet above has the logic "If the field HomePageURL is not empty". This is a common technique to check for empty fields in the user's input. The rest of the IF command inserts the URL into the HREF part of an anchor tag.

THEN "<A HREF=<REPLACE HomePageURL>>">

The second part of the IF command, following THEN, is text that will be inserted if the condition is met.

Here the second part of the IF command actually has a REPLACE command inside it. By putting the REPLACE inside the IF command, the replacement may not be made depending on the IF command. This works because NetCloak Pro executes all of the IF commands first, then goes through and executes the REPLACE commands. You can also use this technique to create very complex forums by conditionally executing RESPONSE or CHAIN directives.

Line 7 - The next line uses a similar IF command sequence to insert the user's e-mail address only if they have entered something into the EMail field.

Line 9 - The IF command here will insert a comma between the title and company name if the user has entered a title.

Line 11 - The <DL> tag will format the next few lines as a definition list so they will be nicely indented.

Line 12 - This line starts out with a <DD> tag to indent the HTML. Here is yet another IF command to create a link to the user's company Web site only if they have entered the URL for one.

Line 15 - This assumes that if the user didn't enter anything on the first description line, they probably didn't enter anything on the second either. If there is something on the first description line, it inserts both.

Lines 16-17 - These two close the definition list and then insert a horizontal rule to separate the new entry from the existing ones.

Recipes Tutorial: Creating New Pages

As an example of how to create new pages on your site with NetCloak Pro, we will build a very simple system for users to share recipes. This tutorial example uses the CREATEDOC directive to create new pages from information submitted by users, as well as the MENUDOC directive to automatically build a list of links to the new pages.

The exact same methodology could be applied to a system for posting bulletins, news articles, student essays, personal home pages, discussion forums, or any other system where users of your Web site need to be able to create content for other users. Turn your Web site into more than a collection of Web pages... make it an interactive resource for your users.

A Recipe System

The recipe system will have three main components: a menu, recipe pages, and a form where users can add recipes to the system. We'll start with the recipe menu, which will look like this when just a few recipes have been entered.

As you can see, we'll be using very simplistic HTML formatting, to make reading the example as easy as possible.

Figure 3: A sample Recipes list.

When a user clicks on one of the recipe links, they will be taken to a full recipe page. We'll prototype this page as well. Here is how the Rice Crispies page might look:

Figure 4: A sample recipe— Rice Crispy Treats

Notice that we have created sample pages that can be used as prototypes for building the fully interactive system. You might be tempted to jump right in an build a highly interactive system in a single step, but it is always better to slow down and take things one step at a time. In the final system, the menu page will be automatically maintained and the recipes automatically created, but for now, we hard code the samples.

One more page will be needed, the input form that allows visitors to submit new recipes. Here is what that page will look like:

Figure 5: The Recipe Entry form.

With this basic three page system, users can review the list of recipes, read (and print out) full recipe descriptions, and submit new recipes to the system. We could specify many additional bells and whistles, but again, the key is to start with a solid, properly working mechanism onto which new features can be added later.

Building The System

Each of the three pages shown above could have been created using any HTML editor or text processor. Let's take a look at the prototype recipe menu page…

<HTML>
<HEAD>
<TITLE>Recipes</TITLE>
</HEAD>
<BODY BGColor=#FFFFFF>
<CENTER><H3>Recipes</H3></CENTER>
Welcome to our public recipe swap forum. Choose a recipe from the list below, or <A HREF="EnterRecipe.html">add a recipe yourself</A>!
<DL>
<!--RecipesGoHere-->
<DD><A HREF="RiceCrispyTreats.html">Rice Crispy Treats</A>
(submitted by Bob on 5/22/00)<P>
<DD><A HREF="BreadPudding.html">Bread Pudding</A> (submitted by Mary on 5/21/00) <P>
<DD><A HREF="WhiteChocolateBrownies.html">White Chocolate
Brownies</A> (submitted by Chuck on 5/21/00)<P>
</DL>
</BODY>
</HTML>

The entire page is made up of plain HTML. Note the link to the form, EnterRecipe.html.

The third section is the list of recipes, formatted using the definition list (DL) tag. Of note here is the HTML comment <!--RecipesGoHere--> which will be used by the FDML file later to specify the place in the file where new recipe listings should be added.

When a user decides to add a recipe, they will click on the "add a recipe yourself" link on the page and be taken to the input form shown above. The HTML source looks like this:

<HTML>
<HEAD>
<TITLE>Recipes</TITLE>
</HEAD>
<BODY BGColor=#FFFFFF>
<CENTER><H3>Recipe Entry</H3></CENTER>
<FORM METHOD=POST ACTION="Recipes/Recipe.fdml">
<B>Author:</B> <BR>
<INPUT TYPE="text" NAME="Author" SIZE="30" MAXLENGTH="30">
<P>
<B>Recipe Name:</B> <BR>
<INPUT TYPE="text" NAME="RecipeName" SIZE="30" MAXLENGTH="30">
<P>
<B>Ingredients:</B> (enter each ingredient on a separate line)<BR>
<TEXTAREA NAME="Ingredients" ROWS=3 COLS=56></TEXTAREA>
<P>
<B>Directions:</B><BR>
<TEXTAREA NAME="Directions" ROWS=3 COLS=56></TEXTAREA>
<P>
<CENTER>
<INPUT TYPE="submit" VALUE="Submit Recipe">
</CENTER>
<P>
</FORM>
<CENTER><A HREF="Recipes/RecipeMenu.html">Return To Recipes Menu</A></CENTER>
</BODY>
</HTML>

The form in the middle section, set off by <FORM> and </FORM> tags, is the interesting part. First, the FORM tag itself includes two crucial parameters. The first is METHOD=POST, which tells the browser to use the HTTP POST method for sending the data to the server. The POST method sends the form data to the server in part of the HTTP request that is hidden from the user, and allows a large amount of data to be sent. The other possible method is GET where the form data is sent in the URL. The GET method is limited by the maximum size of a URL. NetCloak does support the GET method, but POST is the best choice for most systems.

After the METHOD, the FORM ACTION is set. This is simply a URL to the FDML file that we will create below. The ACTION URL can be a file-relative partial URL, a root-relative URL, or a fully qualified URL (beginning "http://"). In this case, a file relative URL is used since the FDML is in the same folder as the input form.

Following the FORM command are the four input fields we will need the user to complete. In this example, we specify two fixed length text fields, for the author and the recipe name. There are two scrolling text areas for the ingredients and directions because these will usually be several lines of text.

When the user completes the form and clicks submit, the FDML file is invoked and the real work is finally done.

Processing The Form Data

To create the FDML file, we start with the sample recipe we already created:

<HTML>
<HEAD>
<TITLE>Rice Crispy Treats</TITLE>
</HEAD>
<BODY BGColor=#FFFFFF>
<CENTER><H3>Rice Crispy Treats</H3></CENTER>
This recipe submitted by Bob on 5/22/00.
<P>
<B>Ingredients</B>
<P>
<UL>
<LI>Rice Crispies (4 cups)
<LI>Marshmellows (1 16 oz. bag)
<LI>Butter (1 stick)
</UL>
<P>
<B>Directions</B>
<P>
Melt marshmallows and butter in a sauce pan over low heat. Pour Rice Crispies into a large bowl, and slowly fold in marshmallow sauce, gently stirring. Spoon mixture into greased pan and allow to cool.
<P>
Cut and serve!
<P>
<CENTER><A HREF="Recipes/RecipeMenu.html">Return To Recipes Menu</A></CENTER>
</BODY>
</HTML>

First, we'll remove the Rice Crispy specific text and replace it with NetCloak REPLACE commands. The REPLACE command is used to insert the contents of a field, as entered by the user, at the specified point. For example, the author's name (Bob) in the listing above will be replaced with a <REPLACE Author> command. The variable Author is the name of one of the input fields, and comes from the input form.

The template for the recipe page, with NetCloak commands used in place of the sample text, is:

<HTML>
<HEAD>
<TITLE><REPLACE RecipeName></TITLE>
</HEAD>
<BODY BGColor=#FFFFFF>
<CENTER><H3>REPLACE RecipeName</H3></CENTER>
This recipe submitted by <REPLACE Author> on <DATE>.
<P>
<B>Ingredients</B>
<P>
<BULLET Ingredients>
<P>
<B>Directions</B>
<P>
<REPLACE Directions>
<P>
<CENTER><A HREF="Recipes/RecipeMenu.html">Return To Recipes
Menu</A></CENTER>
</BODY>
</HTML>

Notice that the <REPLACE RecipeName> is used twice, first in the page title and again as the headline of the page. This is perfectly legal, and form variables may be used as many times as you like in any FDML file.

The line "this recipe submitted by" includes the <REPLACE Author> command to insert the author's name, followed closely by the NetCloak <DATE> command. This tag, used without parameters, simply inserts the current date into the newly created file.

The Ingredients section includes another new command, BULLET. This command is similar to REPLACE, inserting the contents of the specified input field (in this case, the Ingredients field). BULLET, however, inserts data from the form field with HTML tags to make each line of the input field an item in an unordered list.

The directions are inserted using a plain REPLACE command. Of note here is that the text entered by the user for the directions may include carriage returns. NetCloak automatically converts a single return to an HTML <BR> tag and two consecutive returns to a <P> tag. This maintains the line and paragraph breaks when the directions are inserted into an HTML file.

Now it is time to tell NetCloak what to do with our template. A CREATEDOC directive will create the new page for the recipe, and a MENUDOC to add a link to the new page in the recipe menu. Finally, a RESPONSE directive will send our custom response page to the user after they submit the form instead of NetCloak's built in "Thank You" message.

Here is the directive block for the recipe system:

<CREATEDOC>"<REPLACE_FN RecipeName>.html" </CREATEDOC>
<MENUDOC "<!--RecipesGoHere-->"> "Recipes/RecipeMenu.html"
<DD><A HREF="<HTMLFILENAME>">
<REPLACE RecipeName></A>
(submitted by <REPLACE Author> on <DATE>)
<P>
</MENUDOC>
<RESPONSE>"Recipes/ThankYou.html" </RESPONSE>

All FDML files must include exactly one Primary Directive; in this case, CREATEDOC. This directive tells NetCloak to create a new HTML page on the server. Inside of the <CREATEDOC> and </CREATEDOC> tags, the name of the file to be created is specified.

The filename specified in the CREATEDOC command can be either just a filename (in which case the file created will be placed into the same folder as the FDML file) or a full root-relative path to place the new file in another folder. Paths specified inside FDML tags may not be full URLs. NetCloak processes files using the file system on the server, not HTTP, so it cannot create files on another server or site.

Also note the REPLACE commands inside the CREATEDOC directive to give the new file the same name as the recipe. A special version of the REPLACE command, REPLACE_FN, is provided specifically for use in filenames. The REPLACE_FN command works like the normal replace command, but also removes characters that may result in invalid file names or URLs. For example, spaces, which must be encoded in URLs, are removed altogether, so that when a user creates a recipe with the title Rice Crispy Treats the REPLACE_FN tag will insert RiceCrispyTreats. The resulting CREATEDOC command will then be:

<CREATEDOC>"Recipes/RiceCrispyTreats.html" </CREATEDOC>

The next directive in the block is the MENUDOC command. It tells NetCloak that a menu is being maintained, which will provide a link to the newly created page. Inside the opening tag of the MENUDOC directive is the HTML comment in the menu page which specifies where new links should be added. In the listing of the HTML source for the menu above, you can see that the comment <!--RecipesGoHere--> appears at the top of the list, right where links to newly created recipes should go.

Immediately after the opening MENUDOC tag is the filename of the menu to be updated, enclosed by double quotes. Again, this is specified as a root-relative path, although a filename is also sufficient if the menu page is in the same folder as the FDML file.

After the filename of the menu page is the text and HTML that will be added to the menu. Here, we've taken a line from the menu and replaced the static sample text with NetCloak REPLACE, DATE, and HTMLFILENAME commands, just like making the recipe page template. Specifying the full text of the menu item to be inserted gives you the flexibility to format menu pages any way you like. In this case, the menu is formatted as a definition list, and not only provides a link to the page, but lists the author and the date the recipe was added as well.

The HTMLFILENAME command provides an easy way to link to the new page created by a CREATEDOC directive. This command will insert a root-relative path to the new file, and is most frequently used to create a link to the new page inside the MENUDOC command.

The last FDML directive in the block is the RESPONSE command. This directive simply tells NetCloak what file to return to the user when the input form is submitted. Normally, this will be a very simple page thanking the user for their submission and providing a link or two back to key pages in the system. In this case, for example, a link would be provided to the recipe menu page. When using this directive in your own systems, remember it accepts the path to a file on the server, not a URL.

Creating This System Yourself

The system described here makes an excellent starting point for many other similar solutions, and is also a good base upon which to experiment with other NetCloak forms processing systems. To get the recipe system up and running on your own server, copy the Recipes folder out of the Extras folder included in the NetCloak package into your web server or site's root folder.

Now you are ready to try the system. On any Web browser, go to the recipe menu with the URL:

http://your.server/Recipes/RecipeMenu.html

Of course, you will need to replace "your.server" with the address or domain name of your Web server.

The menu page that appears will be quite short, because no recipes have been entered yet. For now, just click the "add a recipe…" link.

When the recipe entry page appears, fill out the form completely. To see that the system is working, complete the fields as you would if you were entering a real recipe. In particular, enter several ingredients, with each on its own line, and enter a few paragraphs of directions. When you are done, click the Submit button.

Notice that the next page displayed is the Thank You page. Return to the recipe menu by clicking the link on the page. Back on the recipe menu page, click Reload if the new recipe is not listed. If the recipe is still not shown, try a power reload by holding down the option key while clicking the reload button (if you are using Netscape Navigator).

The new recipe should now appear on the menu, and clicking on the link should display the full recipe. Go back to the Finder on the Web server and take a look at the Recipes folder… a new file has been added and is named according to the recipe name entered. You can open and edit this file just like any other HTML page on your server.

Creating Pages: The Feedback Example

This example is a feedback that allows users to enter comments about the Internet into your server. Other users can then add responses to the original comments. Before you start reading how the example is put together, make sure you have entered a few articles and know how it works. Go to the NetCloak Introduction pages and click on Feedback under the Examples.

The Feedback home page has links to the original article entry form and to several separate menu documents. In this example, new articles will be broken down into one of several forums to make it easier for users to find what they want. This particular example uses the forums General Internet, This Site, and Other Sites, but it could be any other logical breakdown of topics appropriate for the system.

Each of the forums has its own menu document. These documents are all exactly the same, except for their titles and minor variations in their text. Most importantly, since each menu document will be updated by NetCloak Pro, each needs to have a single unordered list.

Most of the form should be self-explanatory. Note that the pop-up list for the topic name only lets the user select one of the pre-defined choices.

Now for the interesting part. The Feedback.FDML template will generate the original articles. Responses to original articles will be handled by a different FDML template. The Feedback.FDML file is as follows:

 

Response">
51) <INPUT TYPE="reset" VALUE="Start Over"><p>
52) </FORM>
53) <HR>
54) Article complete. Click
<A HREF="/Feedback/Feedback.html">HERE</A>
55) To return to the Feedback Menu.
56) </BODY>
57) </HTML>

Lines 1-3 - The CREATEDOC directive places the new document into a sub folder based on the name of the forum using the REPLACE_FN insertion command.

Placing documents into separate forum sub-folders is not necessary, but will help to keep the documents in each folder to a manageable number, in addition to providing a logical breakdown.

Notice the use of REPLACE_FN here where the value will be used as a file or folder name.

Line 4 - The AUTOLINK directive will create automatic links to any key words entered by the user which match entries in the AutoLink.doc file. See the section on the AutoLink directive for an explanation of how this works.

Line 5 - The MENUDOC directive again uses the REPLACE_FN command to update the menu document for the selected forum.

Line 6 - Note the use of the HTMLFILENAME insertion command. This command inserts the path and filename for the HTML file specified in the CREATEDOC directive. We could have repeated the parameter inside the CREATEDOC directive, but the HTMLFILENAME command is much shorter and makes it easier to understand what is going on.

Here comes the real trick to this example: The HTML documents generated by this FDML will contain not only the content of the original message, but an input form and menu of responses.

The LINKNEXT and LINKPREVIOUS insertion commands here will automatically insert links to the previous article and next article entered. When it creates the HTML document for the current article, NetCloak Pro will put a placeholder in place of the LINKNEXT tag, and replace it with a real link when the next article is entered.

Line 26 - The MENUFILENAME here will automatically insert the complete name and path to the menu file specified in the MENUDOC directive. We could have repeated what was inside the MENUDOC directive, but this is a handy shortcut.

Lines 30-31 - Note the bullet list (<UL></UL>, since it's empty to begin with), which is preceded by a text blurb stating that responses are available. This bullet list will be updated automatically when responses are posted to the original article.

Lines 35-52 - Here is another entry form at the end of the document which the FDML file will create in the new article. The last two fields (lines 43 and 47), when the form is displayed, will default to the correct values and should not be modified by the users. This is where the name of the original article is passed to the FDML which will process the response.

When a user fills in the response entry form, NetCloak Pro will again be invoked, but this time it will use the "FeedbackResponse.FDML" file:

 

/Feedback.html">HERE</A>
30) To return to the Feedback Menu.
31) </BODY>
32) </HTML>

The notable thing in FeedbackResponse.FDML is that it uses the original article document as its menu document. By doing this, responses will be added directly in to the bullet list on the original article page.

One additional note about the Feedback example. Two fields in the "Feedback.FDML" file, "OrigArticle" and "OrigForum", were implemented as standard text fields in order to make what is happening more clear in the example. In a production system, you would most likely want to make these hidden fields so that the user won't ever see them. See an HTML language guide for more details on hidden fields.


Copyright © 1996-2000 Maxum Development Corporation

http://www.maxum.com/
Previous | Next
Contents