<%
Const TxtLpHeader = "Latest Posts"
Const TxtLpForum = "Forum"
Const TxtLpTopic = "Topic"
Const TxtLpAuthor = "Author"
Const TxtLpDate = "Date"
Const TxtLpViews = "Views"
%>
<%
Response.Write ("<table align=""center"" width=""98%"" class=""tableBorder"" cellspacing=""1"" cellpadding=""3"">" & _
vbCrLf & "<tr class=""tableLedger"">" & _
vbCrLf & "<td colspan=""5"">" & TxtLpHeader & "</td>" & _
vbCrLf & "</tr>" & _
vbCrLf & "<tr class=""tableSubLedger"">" & _
vbCrLf & "<td>" & TxtLpForum & "</td>" & _
vbCrLf & "<td>" & TxtLpTopic & "</td>" & _
vbCrLf & "<td>" & TxtLpAuthor & "</td>" & _
vbCrLf & "<td>" & TxtLpDate & "</td>" & _
vbCrLf & "<td>" & TxtLpViews & "</td>" & _
vbCrLf & "</tr>")
%>
<%
Dim rsLatestPosts
Dim intLimit
Dim rsLatestPosts2
Dim sql2
Dim LastLatestPostsDateTime
Dim LastLatestPostsDate
Dim LastLatestPostsTime
Set rsLatestPosts = Server.CreateObject("ADODB.Recordset")
strSql = "Select " & strDbTable & "Topic.Subject, " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Topic.Last_Thread_ID, " & strDbTable & "Topic.No_of_views "
strSql = strSql & "From " & strDbTable & "Topic, " & strDbTable & "Forum Where " & strDbTable & "Topic.Hide = False And " & strDbTable & "Topic.Forum_ID = " & strDbTable & "Forum.Forum_ID Order By " & strDbTable & "Topic.Last_Thread_ID desc"
rsLatestPosts.Open strSQL, adoCon
For intLimit = 1 to 10
if rsLatestPosts.Eof Then Exit For
Set rsLatestPosts2 = Server.CreateObject("ADODB.Recordset")
sql2 = "SELECT " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Topic_ID, " & strDbTable & "Thread.Message_date, " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID FROM (" & strDbTable & "Author INNER JOIN " & strDbTable & "Thread ON " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID) WHERE " & strDbTable & "Thread.Hide = False And Topic_ID= " & rsLatestPosts("Topic_ID") & " order by Message_date desc"
rsLatestPosts2.Open sql2, adoCon
if not rsLatestPosts2.EOF Then
LastLatestPostsDateTime = rsLatestPosts2("Message_date")
LastLatestPostsDate = DateFormat(LastLatestPostsDateTime)
LastLatestPostsTime = TimeFormat(LastLatestPostsDateTime)
Response.Write ("<tr class=""tableRow"">" & _
vbCrLf & "<td><a href=""forum_topics.asp?FID=" & rsLatestPosts("Forum_ID") & strQsSID2 & """ title=""Click To View Forum"">" & rsLatestPosts("Forum_name") & "</a></td>" & _
vbCrLf & "<td><a href=""forum_posts.asp?TID=" & rsLatestPosts("Topic_ID") & strQsSID2 & """><a href=""forum_posts.asp?TID=" & rsLatestPosts("Topic_ID") & "&get=last#" & rsLatestPosts("Last_Thread_ID") & strQsSID2 &""" title=""Click To View Last Post"">" & rsLatestPosts("Subject") & "</a></td>" & _
vbCrLf & "<td>"&rsLatestPosts2("Username") &"</td>" & _
vbCrLf & "<td>" & LastLatestPostsDate & "-" & LastLatestPostsTime & "</td>" & _
vbCrLf & "<td>" & rsLatestPosts("No_of_views") & "</td></tr>")
end if
rsLatestPosts2.Close
rsLatestPosts.MoveNext
Next
rsLatestPosts.Close
Response.Write ("</table")
%>