| ||||
|
Home RAD Main template.asp The addForm Sub The Before index.asp The After index.asp Page The After Include Page Demo
|
Separating navigation from content when developing applications. Let's build a simple Message Board application. In this application we'll let messages be added and then display the ten most recent. We start by adding the two navigation links. My convention is to call the query strings "do". Later you'll see where the form values are called "action", it helps keep things organized. <a href=<%=
Request.ServerVariables("SCRIPT_NAME") %>?do =
show>Show </a>
| OK, now we need a database for this application.
For our purposes of this application we'll only need three fields: Now that we have the database, we'll use Buildapp to generate most of the code that we'll be using. We use the "Create HTML Add Form" link, for example, to generate our add form. Then use "view source" to grab the following code. (While this is a very small form, easily hand coded, when you go to a bigger database you'll appreaciate this feature, which makes form building mostly a copy/paste operation):
We now modify it and make it a Sub. Note that POSTWHEN is now hidden with a value of "now()", effectively making it a timestamp and the form will be submitted to this page. The sub, addForm(), is called by clicking on the "Add" link.
Now we go back to the application generated by
Buildapp and grab connect.asp and the submission code and make two more Subs and
a Function.
Then we add an "Else If" condition to call the new "addPost"
Sub. Everything seems to be
working now, so we'll now make a new include page and move the subs and function
there then include the new include.asp page. As the subs and functions are built and tested, they are moved to the include page. By doing this the "working space" is uncluttered enabling one to focus on the current step of the application. And if you need to go back and rework an sub or function, simply cut it from include.asp and move back to the index.asp page. When your're finished reworking the code, just reverse the process. The process continues until the application is completed.
Do Until End of Application The finished
message board application disallows duplicate messages and when there are more
than thirty records, it automatically deletes 20 messages and compacts the
database . When you look at
the finished include.asp, note that all the subs and functions are listed at
the top of the include.asp page. This is your "Table of Contents" for that page.
Do a simple search to quickly locate the particular sub or function that
you are looking for.
Do the
Demo
Michael Brinkley - Janurary 2, 2002 | |||