%@LANGUAGE="VBSCRIPT"%>
<%
varAuto = Request("fldIndex")
Dim varSql
varSql = "SELECT * FROM memorial ORDER BY fldDate DESC"
Dim varPageSize
varPageSize = "10"
%>
<%
'==========================================================
' PAGED RECORDSET
' This code takes a few page-specific variables and opens
' a "paged" recordset.
'==========================================================
If varSql <> "" Then
Dim objConnPager
Dim intPageCount
Dim intRecordCount
Dim intPage
Dim intRecord
Dim intStart
Dim intFinish
If Request("varPage") = "" Then
intPage = 1
Else
intPage = Request("varPage")
End If
Set objConnPager = Server.CreateObject("ADODB.Connection")
objConnPager.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\sites\tld\troop231.org\public_html\memorial\dibdibdib.mdb;"
objConnPager.Open
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3 'adUseClient
rs.CursorType = 3 'adOpenStatic
rs.ActiveConnection = objConnPager
rs.Open varSql
rs.PageSize = varPageSize
rs.CacheSize = rs.PageSize
intPageCount = rs.PageCount
intRecordCount = rs.RecordCount
If CInt(intPage) > CInt(intPageCount) Then intPage = intPageCount
If CInt(intPage) <= 0 Then intPage = 1
If intRecordCount > 0 Then
rs.AbsolutePage = intPage
intStart = rs.AbsolutePosition
If CInt(intPage) = CInt(intPageCount) Then
intFinish = intRecordCount
Else
intFinish = intStart + (rs.PageSize - 1)
End if
End If
If rs.EOF Then
varEmpty = True
End If
'==========================================================
' Here we set the variable "varPagesList".
' This will show a formatted div containing linked page numbers.
' eg: Page 1 - 2 - 3 - [4] - 5 - 6
'==========================================================
varPagesList = "Page "
For I = 1 To intPageCount
If I = cInt(intPage) Then
varPageCount = varPageCount & " • " & I & ""
Else
varPageCount = varPageCount & " • " & I & ""
End If
Next
If intPageCount < 1 Then
varPageCount = varPageCount & " • [1]"
End If
varPageCountLen = len(varPageCount)-2
varPageCount = Right(varPageCount, varPageCountLen) 'remove the leading "- "
varPagesList = varPagesList & varPageCount
varPagesList = varPagesList & ""
'==========================================================
' Here we set the variable "varPrevNext".
' This will show the "<< previous page | next page >>" links
' if they are required.
'==========================================================
If cInt(intPage) > 1 Then
varPrevLink = "" & _
"« Previous Page"
Else
varPrevLink = "« Previous Page"
End If
If cInt(intPage) < cInt(intPageCount) Then
varNextLink = "" & _
"Next Page »"
Else
varNextLink = "Next Page »"
End If
If cInt(intPageCount) > 1 Then
varPrevNext = "" & varPrevLink & " • " & varNextLink & ""
Else
varPrevNext = ""
End If
'==========================================================
' Here we set the variable "varSortOrderForm".
' This will show the form that allows the user to re-sort
' and re-order the database based on their input
'==========================================================
If varSortFields <> "" Then
varSortOrderForm = "" & _
"" & _
"" & _
""
End If
varPagerTabled = varPrevNext
End If
%>
<%
Function stripHTML(strHTML)
strHTML = Replace(strHTML, " ", " ")
strHTML = Replace(strHTML, " ", " ")
strHTML = Replace(strHTML, "
", " ")
strHTML = Replace(strHTML, "", " ")
strHTML = Replace(strHTML, " ", " ")
strHTML = Replace(strHTML, "''", "'")
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|\n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
'strOutput = Replace(strOutput, chr(10), " ")
strOutput = Replace(strOutput, chr(13), " ")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function
%>
Troop231.org - Boy Scouts of America
<% If NOT varEmpty = True Then %>
<% intNum = intStart
For intRecord = 1 to rs.PageSize
%>
<%=stripHTML(rs("fldMessage"))%>
<%=stripHTML(rs("fldName"))%>
<% Response.Write FormatDateTime(DateAdd("h",-13,rs("fldDate")),1) %>
<%
intNum = intNum + 1
rs.MoveNext
%>
<%
If rs.EOF Then Exit for
Next
End If
%>
<% If varEmpty = True Then Response.Write("No comments posted yet") : Response.Write("")%>
<%
rs.Close
Set rs = Nothing
%>
<%=varPagerTabled%> <%=varPagesList%>