BarrMan
12-10-2005, 04:55 PM
I got a paging code that checks if the current page greater than 3 if it isn't it shows the page links from 1 to 5(there is another condition there), if it is greater than 3 it shows the current page - 2 to currentpage + 2.
Here is the code:
<%
If CurrentPage < 3 Then
If PageCount <= 5 Then
For i = 1 To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = 1 To 5
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
Else
If PageCount >= (CurrentPage + 2) Then
For i = (CurrentPage - 2) To (CurrentPage + 2)
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&?page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = (PageCount - 5) To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
End If
%>
The problem is:
Everytime i press on the 4th page it gets me to the first page although in the querystring it shows page=4.
To see the full page you can click here: http://e.domaindlx.com/BarrMan/BestForums/forums.asp?s=1&page=1&w=thread&f=allforums&o=both
Here is the code:
<%
If CurrentPage < 3 Then
If PageCount <= 5 Then
For i = 1 To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = 1 To 5
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
Else
If PageCount >= (CurrentPage + 2) Then
For i = (CurrentPage - 2) To (CurrentPage + 2)
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&?page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
Else
For i = (PageCount - 5) To PageCount
If i = CurrentPage Then
Response.Write i & VBCrlf
Else
Response.Write "<a href=forums.asp?s=1&page=" & i & "&w=" & word & "&f=" & forum & "&o=" & foption & ">" & i & "</a>" & VBcrlf
End If
Next
End If
End If
%>
The problem is:
Everytime i press on the 4th page it gets me to the first page although in the querystring it shows page=4.
To see the full page you can click here: http://e.domaindlx.com/BarrMan/BestForums/forums.asp?s=1&page=1&w=thread&f=allforums&o=both