Nyeste 5
Jeg har et forum som includer en INC-fil. Jeg skal i dette tilfælde vise de 5 nyeste indlæg, som man skulle kunne trykke på en af de 5 og så kunne besvare spørgsmålet:default filen (kaldt last5forum.asp) ses her:
<%Option Explicit%>
<!--#include file="last5forum.inc" -->
<!--#include file="forum/boardx/utilities.inc" -->
<%
'connect to the database
Set dbRS = Server.CreateObject("ADODB.Recordset")
With dbRS
.CursorLocation = 3
.CacheSize = C_dbPageSize
.Open strSQL, C_dbConnect
End With
If dbRS.EOF = False Then
With dbRS
.MoveFirst
topicCount = CInt(.RecordCount)
.PageSize = C_dbPageSize
pageCount = CInt(.PageCount)
.AbsolutePage = curPage
End With
Else
topicCount = 0
pageCount = 1
End If
'preconstruct query strings to keep things simple
stateQS = "curPage=" & curPage & "&"
stateQS = stateQS & "search=" & Server.URLEncode(strSearch)
%>
<html>
<head>
<meta name="Description" content=":: WMA Forum ::">
<meta name="Keywords" content="wmaforum wma wmadebat debatforum wmaspørgsmål">
<title><%=C_PageTitle%> :: Emner</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--#include file="forum/boardx/javascript.inc" -->
<!--#include file="forum/boardx/style.inc" -->
</head>
<%=C_PageBody%>
<%=C_PageLogo%>
<br>
<p>
<br>
<br>
<table border="0" cellspacing="1" cellpadding="2" width="100%">
<%
If dbRS.EOF Then
%>
<%
Else
Do Until dbRS.EOF Or x >= C_dbPageSize
%>
<tr>
<td width="<%=fieldWidths(0)%>" valign="top"><a href="forum/boardx/read.asp?ID=<%
If dbRS("parentID") = 0 Then
Response.Write dbRS("ID")
Else
Response.Write dbRS("parentID")
End If
%>&<%=stateQS%>"><%=db2web(dbRS("topic"))%></a></td>
<td width="<%=fieldWidths(1)%>" valign="top"><%=db2web(dbRS("author"))%></td>
<td width="<%=fieldWidths(2)%>" valign="top"><%=FormatDateTime(dbRS("date_posted"),2)%></td>
<td width="<%=fieldWidths(3)%>" valign="top"><%
If dbRS("parentID") = 0 Then
Response.Write dbRS("replies")
Else
Response.Write "-"
End If
%></td>
</tr>
<%
x = x + 1
dbRS.MoveNext
Loop
End If
%>
</table>
<br>
<p>
<br>
</html>
<%
'clear recordset from memory
Set dbRS = Nothing
'store sort settings in session variables
Session("sortBy") = sortBy
Session("sortDir") = sortDir
%>
Skriver lige INC filen i næste felt!
