|
hyBook - A Simple Guestbook Application
Part:
1
2
3
4
5
6
7
8
9
10
11
12
13
(Continued from previous part...)
Function htmlCommentList(ngTopicID)
Set rsComment = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT * FROM [hyComment] WHERE [TopicID] =" _
& ngTopicID & " ORDER BY ID DESC"
rsComment.Open sSQL, ogConn
If rsComment.EOF Then
htmlNotice("No comment has been submitted.")
Else
Response.Write("<table class=hy_list cellspacing=0" _
& " cellpadding=5>")
sClass="hy_list_item_lo"
Do While NOT rsComment.EOF
Response.Write("<tr class=" & sClass & "><td><b>" _
& rsComment("Name") & "</b> wrote on " _
& rsComment("Timestamp") & ": <br><br>")
Response.Write(replace(rsComment("Content"), vbcrlf, "<br>")_
& "</td></tr>")
rsComment.MoveNext
If sClass = "hy_list_item_lo" Then
sClass = "hy_list_item_hi"
Else
sClass = "hy_list_item_lo"
End If
Loop
Response.Write("</table>")
End If
set rsComment = Nothing
End Function
Function htmlNotice(sText)
Response.Write("<table class=hy_notice cellspacing=0" _
& " cellpadding=5>")
Response.Write("<tr><td>" & sText & "</td></tr>")
Response.Write("</table>")
End Function
Function htmlError(sText)
Response.Write("<table class=hy_error cellspacing=0" _
& " cellpadding=5>")
Response.Write("<tr><td>" & sText & "</td></tr>")
Response.Write("</table>")
End Function
Function myDump
aKeys = hgRqParam.Keys()
ogDebug.WriteLine("Values in hgRqParam:")
For i=0 To hgRqParam.Count-1
k = aKeys(i)
ogDebug.WriteLine(k & " = (" & hgRqParam.Item(k) & ")")
Next
aKeys = hgPgParam.Keys()
ogDebug.WriteLine("Values in hgPgParam:")
For i=0 To hgRqParam.Count-1
k = aKeys(i)
ogDebug.WriteLine(k & " = (" & hgPgParam.Item(k) & ")")
Next
End Function
%>
Interesting things to note here:
- "_congif.inc" is included at the very beginning of the page to make sure that all global
variables and functions are available to the entire page.
- "_template.inc" is included after some page level variables are defined.
- "opening" is implemented to take care of input data from the query string and submitted form.
- "outputHeader" is implemented to display the page title.
- "outputBody" is implemented to display the topic, existing comments, and a blank form.
- "outputFooter" is implemented as an empty function.
- "closing" is implemented to just call database disconnection function.
(Continued on next part...)
Part:
1
2
3
4
5
6
7
8
9
10
11
12
13
|