Lesson 14. Managing Content with Forms

A content management system, as its name suggests, is an interface that facilitates the maintenance of content, including the addition of new content, the modification of existing content, and the removal of unwanted content. In this and the next two lessons, you will make steps toward building a content manage ment system (CMS) for the Newland Tours site. You won't build a fully comprehensive CMS, which is an ambitious and often redundant task, making it of limited value in this book. But you will build enough of it to get a sense of how they work, and the know-how to start building your own.

By inserting some HTML as the default text in a text area, you can provide users a template for creating formatted text.

graphics/14fig01.gif

How do CMSs work? You can look at this question as a functional question (how can Web content be maintained over the Web?) or as a technical question (how do we use available technologies to make this possible?). Whenever you face a problem like this, answer the functional question first, and then worry about the technical answer.

In practice, CMSs typically include several pages with forms on them. When users fill out the forms, whatever they entered appears on the site. You don't want these forms to be accessible to the public, which is why we created the log-in framework first. You have probably guessed how this process from form to Web works: database connectivity. You know that the contents of a Web page can be populated with database data, and you know that you can capture user-entered information from a form and put it in a database. Put two and two together, and voila! A content management system.

Note that Macromedia has recently released a revolutionary new approach to content management, called Contribute. Contribute enables non-technical users to maintain site content in a friendly, office productivity tool-like environment. Contribute has both advantages and disadvantages compared to a CMS using a database and ASP or ColdFusion. As a Web editor, Contribute enables users to format content much more robustly and easily than the best CMS. And because it works mainly with static sites, Contribute is generally a less expensive solution. On the down side, Contribute doesn't work with database content. As a rule, use Contribute for text- and image-heavy static sites whose contents need occasional updating, and use dynamic pages and a database for highly structured or data-oriented sites whose contents change frequently, or on sites whose contents need to be searchable.

Back to the CMS we'll begin in this lesson. Content maintenance implies three abilities: inserting content, modifying content, and deleting content. If you know any SQL, you are probably aware of the INSERT, UPDATE, and DELETE statements, which make it possible to insert, modify, and delete data from a database. If you don't know SQL, don't worry: you'll get practice with each of these statements in this and the next two lessons. You will use these in your queries, rather than simple SELECT statements, to make content manageable.

The primary task remaining is to create form interfaces that serve as the front-end for the work going on in the background. Some of these, especially those for inserting data, are quite easy to create. In fact, by building the registration form, you've already created one. Updating and deleting data are a little trickier, because you have to retrieve data from the database and make it available to the user, so she or he can send the requisite queries back to the database to do the actual updating or deleting.

In this lesson, you will create the simplest portion of the CMS: the form that Newland Tours employees can use to update the Traveler's Journal on the homepage. This functionality requires only a single page, a single form, and a single server behavior (Insert Record).

WHAT YOU WILL LEARN

In this lesson, you will:

  • Empower nontechnical users to add formatted content to a Web page instantly

  • Create an admin section for the site, including a new template

  • Use and customize a text area form element

  • Track user activity with session variables and hidden fields

  • Learn about SQL's INSERT statement

  • Use the Insert Record server behavior

APPROXIMATE TIME

This lesson takes approximately 45 minutes to complete.

LESSON FILES

Starting Files:

Lesson14/Start/newland/generic_template.asp

Lesson14/Start/newland/index.asp

Completed Files:

Lesson14/Complete/newland/admin_template.asp

Lesson14/Complete/newland/admin_index.asp

Lesson14/Complete/newland/admin_update_tj.asp

Lesson14/Complete/newland/index.asp