Let's use the recipe system as our first example. We'll have users enter recipes (name, ingredients, and directions) and then put the list of recipes in a menu available for browsing by other visitors. If you haven't already, take a look at the Recipes example included on the NetForms disk to see just how it works.
First, let's take a look at the Recipe Menu Page. Here is the
HTML for the "RecipeMenu.html" file.
<HTML> <HEAD> <TITLE>Recipe Menu</TITLE> </HEAD> <BODY> <H1>Recipe Menu</H1> If you would like, please <A HREF="RecipeEntry.html">enter your favorite recipe</A> or browse the recipes entered so far... <UL> </UL> <P>IMPORTANT: If this page seems to be missing recently added documents, click the "Reload Page" button on your Web Browser to update the menu. <P> <I>This page is being maintained automatically by NetForms.</I> </BODY> </HTML>
When someone clicks on the "enter your favorite recipe"
link, they will be taken to our entry form "RecipeEntry.html"
which is made up of standard HTML that looks like this:
<HTML> <TITLE>Recipe Entry Form</TITLE> <H1>Recipe Entry Form</H1> <FORM method=POST action="/NetForms.acgi$/Recipes/Recipe.fdml"> Author: <INPUT TYPE="text" NAME="Author" SIZE="30" MAXLENGTH="30"> <P> Recipe Name: <INPUT TYPE="text" NAME="RecipeName" SIZE="30" MAXLENGTH="30"> <P> Ingredients:<BR> <TEXTAREA name="Ingredients" rows=10 cols=60></TEXTAREA> <P> Directions:<BR> <TEXTAREA name="Directions" rows=10 cols=60></TEXTAREA> <P> <INPUT type=submit value="Submit Recipe"> <INPUT type=reset value="Start Over"> <P> </FORM> </HTML>
Notice in particular the fourth line, which is the FORM command. The action portion of this command specifies NetForms.acgi as the handling helper application and gives a path to the FDML document that will be used to process the article. The rest of the form is all standard HTML.
The interesting part of our recipe system is the "Recipe.FDML" file, which is a template where we specify exactly how each incoming form should be processed. Let's look at the file:
1) <CREATEDOC>"/Recipes/<REPLACE_FN RecipeName>.html"</CREATEDOC> 2) <MENUDOC>"/Recipes/RecipeMenu.html"<LI> <A HREF="<HTMLFILENAME>"><REPLACE RecipeName></A></MENUDOC> 3) <HTML> 4) <HEAD> 5) <TITLE><REPLACE RecipeName></TITLE> 6) </HEAD> 7) <BODY> 8) <H1><REPLACE RecipeName></H1> 9) <Address> 10) This article submitted by <REPLACE Author> on <DATE>. 11) </Address> 12) <HR> 13) <H3>Ingredients -</H3> 14) <BULLET Ingredients> 15) <P> 16) <H3>Directions -</H3> 17) <REPLACE Directions> 18) <HR> 19) Article complete. Click 20) <A HREF="/Recipes/RecipeMenu.html">HERE</A> 21) to return to the Recipe Menu Page. 22) </BODY> 23) </HTML>
Line 1 - The <CREATEDOC> directive will always be required. This is the way you tell NetForms to create a new HTML document, based on the prescribed FDML format. Notice in particular the file name and path, the path is specified relative to the Web server root folder. Specifying a sub folder a level deeper than the one your FDML and other documents are in should make the system easier to maintain. This way, all user-entered articles are in a single folder. For this basic example, we have kept everything in the Recipes folder.
Another important thing to notice is how the <REPLACE> command works within directives. This is what allows you to specify unique file names for each article entered.
Line 2 - The <MENUDOC> directive tells NetForms to update the menu page (which in this case is also our Recipe Home Page). It specifies the full path of the HTML document to be updated and then includes HTML syntax to define exactly how the line should look.
Within the <MENUDOC> directive is the command <HTMLFILENAME>, for which NetForms substitutes a path to the newly created HTML file. In addition to the URL, you can specify what the user will see on the menu line. In this example we have chosen to use the recipe name. You could also show the author, date, or whatever you like right on the menu.
Line 3 - While it is not required, it is good form in any HTML document to include the <HTML> tag.
Line 5 - Here the <REPLACE RecipeName> will insert the Recipe Name as the title of the document.
Line 8 - NetForms will place the Recipe Name into a highlight section at the top of the document.
Line 14 - The <BULLET> insertion command will format the ingredient list as a series of bullet points. Bullets are one of a number of ways to format your text.
Line 17 - If you had wanted the ingredients to be plain text on line 14, you could just use a <REPLACE> command, as we have done here with the directions entry field.
That's it--you have an interactive recipe system on your Web server
with the help of NetForms and just 60 lines of HTML! You could
easily enhance your Recipe system by simply using AppleSearch
(or another search engine) to index the recipes and perform full
For practice, you might want to make some additional changes to our example:
If you feel like you know what's going on, you're ready for the
Copyright © 1996-8 Maxum Development Corporation
820 South Bartlett Road - Suite 104
Streamwood, IL 60107