Implementing an Autonomous Content Mechanism
Our current version of the ProfessorF site looks like Figure 2. I took the liberty of adding one kind of autonomous content mechanism: Users can vote on how much they like a hacker phrase, on a scale of 1 to 5. These votes are tallied and the top phrases are summarized in a column on the right-hand side. I also added a similar mechanism for hacker words. These are relatively simple mechanisms to implement, so I won't cover them here. Instead, let's look at how to implement a mechanism that lets users contribute their own hacker phrases.
Figure 2 ProfessorF.com.
Placing the Contribution Link
Where should we put the contribution link? My general rule is to put the link in a consistent, visible location. If the user has to scroll to find the contribution link, or click on several other links before encountering it, then it's in the wrong location. For the hacker phrases, a good place to add the contribution link is at the top of the hacker phrases. It's a visible location, near the middle of the screen, and it's always in the same place for every hacker phrase (see Figure 3):
Figure 3 Contribution link: "Add your own hacker phrase."
To implement this contribution link above the current hacker phrase, we simply add an <A> tag inside the hacker phrase table's <CAPTION> tag (see the bold portion of Listing 1):
Listing 1 Contribution Link (a Portion of Listing 1.asp)
... <TABLE> <CAPTION> <CENTER> <A HREF="add_phrase.asp">Add your own hacker phrase</A> </CENTER> </CAPTION> <TR><TD VALIGN=TOP>Phrase</TD> <TD><B><%=rs("phrase")%> </B></TD></TR> <TR><TD VALIGN=TOP>Usage</TD> <TD><%=rs("usage")%> </TD></TR> <TR><TD VALIGN=TOP>Example</TD> <TD><%=rs("example")%> </TD></TR> </TABLE> ...The <A> tag links to an Active Server Pages (ASP) script—which we have yet to create—named add_phrase.asp. This script will display a form that asks the user for a) a new hacker phrase, b) the condition for that phrase's use, and c) an example of that phrase. When the user clicks the submit phrase button, the script will store the information into the hackerphrase table (the design was covered in the last article, and is shown again in Figure 4).
Figure 4 Database table design for a hacker phrase.
With the contribution link in place, we can now implement the add_phrase.asp script to get the autonomous content from the user and store it in the database.