Hi all..
A long time ago, in the dark ages when we used WWF 7.9x, Zamal created a "Paging Mod". Basically, it displayed the links to other pages like this :
Pages << 1 2 3 4 ... 7 8 9 10 11 12 13 ... 17 18 19 20 >>
|
Current Page
I only had to change a few lines to make it work on my V.8.03, so basically, it's still Zamal's code, but since I only use it for the "forum_posts.asp" page, it's not the complete version. If I remember well, he had modded most things that could display more than one page (Like forum topics, pm inbox, etc..). But since I don't have the original file anymore, you'll have to search for yourself how he did it.
This code works for my forum_posts.asp, you may have to fiddle a bit with it :
[code]
<%
'*******************************************************************************
'*******************************************************************************
'************ Zamal's PageMod
'************ Original V7.x code by Zamal
'************ Updated for 8.03 by Hades
'*******************************************************************************
'*******************************************************************************
%>
<td align="right" nowrap>
<%
'If there is more than 1 page of topics then dispaly drop down list to the other threads
If intTotalRecordsPages > 1 Then
'Display a text link to the last topic
Response.Write (vbCrLf & " <td colspan=""3"" align=""right"" nowrap=""nowrap"">")
Response.write("<a class=""PageLink"">Pages </a>")
'Display a prev link if previous pages are available
If intRecordPositionPageNum > 1 Then
If Request.QueryString("KW") <> "" Then
Response.Write("<a href=""forum_posts.asp?TID=" & lngTopicID & "&KW=" & Server.URLEncode(Request.QueryString("KW")) & "&PN=" & intRecordPositionPageNum -1 & """ class=""PageLink"">" & "<<" & "</a> ")
Else
Response.Write("<a href=""forum_posts.asp?TID=" & lngTopicID & "&PN=" & intRecordPositionPageNum -1 & """ class=""PageLink"">" & "<<" & "</a> ")
End If
End If
dim I
dim LowerMin
Dim LowerMax
dim UpperMin
Dim BottomMax
Dim Range
I = intRecordPositionPageNum
Range = 3
LowerMin = intRecordPositionPageNum - Range
LowerMax = intRecordPositionPageNum + Range
BottomMax = 1 + Range
UpperMin = intTotalRecordsPages - Range
if (LowerMax > intTotalRecordsPages) then
LowerMin = intTotalRecordsPages - (2 * Range)
LowerMax = intTotalRecordsPages
end if
if (LowerMin <= 0) then
LowerMin = 1
LowerMax = LowerMin + (2 * Range)
if LowerMax >= intTotalRecordsPages then
LowerMax = intTotalRecordsPages
end if
end if
if BottomMax >= LowerMin then
BottomMax = LowerMin - 1
end if
if UpperMin <= LowerMax then
UpperMin = LowerMax + 1
end if
For intTopicPageLoopCounter = 1 to BottomMax
If Request.QueryString("KW") <> "" Then
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&KW=<%=Server.URLEncode(Request.QueryString("KW"))%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
Else
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
End If
%> <%=intTopicPageLoopCounter%></a>
<%
next
if (LowerMin - BottomMax > 1 ) then
Response.write("<a class=""PageLink"">...</a>")
end if
For intTopicPageLoopCounter = LowerMin to LowerMax
If Request.QueryString("KW") <> "" Then
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&KW=<%=Server.URLEncode(Request.QueryString("KW"))%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
Else
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
Else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
End If
%> <%=intTopicPageLoopCounter%></a>
<%
next
if (UpperMin - LowerMax > 1) then
Response.write("<a class=""PageLink"">...</a>")
end if
For intTopicPageLoopCounter = UpperMin to intTotalRecordsPages
If Request.QueryString("KW") <> "" Then
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&KW=<%=Server.URLEncode(Request.QueryString("KW"))%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
Else
If intTopicPageLoopCounter = intRecordPositionPageNum Then
Response.write("<a class=""PageLink"">")
else
%> <a href="forum_posts.asp?TID=<%=lngTopicID%>&PN=<%=intTopicPageLoopCounter%>" class="PageLink">
<%
End If
End If
%> <%=intTopicPageLoopCounter%></a>
<%
next
'Display a next link if needed
If intRecordPositionPageNum <> intTotalRecordsPages Then
If Request.QueryString("KW") <> "" Then
Response.Write(" <a href=""forum_posts.asp?TID=" & lngTopicID & "&KW=" & Server.URLEncode(Request.QueryString("KW")) & "&PN=" & intRecordPositionPageNum + 1 & """ class=""PageLink"">" & ">>" & "</a>")
Else
Response.Write(" <a href=""forum_posts.asp?TID=" & lngTopicID & "&PN=" & intRecordPositionPageNum + 1 & """ class=""PageLink"">" & ">>" &