pagination | pagination <%
' Paging program
' Total Records of total_records
' Everypage_records per page display bar count
' Current_page current page
' URL to be passed, where it can contain variables to be passed, such as "list.asp?" or "list.asp?keyword=key&"
' The program call is simpler, but still more than PHP trouble, continue to work
Sub Show_page (Total_records,everypage_records,current_page,url)
If IsNumeric (total_records) Then
Total_records=int (Total_records)
Else
Total_records=0
End If
If IsNumeric (everypage_records) Then
Everypage_records=int (Everypage_records)
If Everypage_records<=0 Then
everypage_records=10
End If
Else
everypage_records=10
End If
If IsNumeric (current_page) Then
Current_page=int (Current_page)
Else
Current_page=1
End If
' Take the total number of pages, that is, the last page
If Total_records mod everypage_records=0 then
Last_page=int (Total_records/everypage_records)
Else
Last_page=int (total_records/everypage_records) +1
End If
' Determine if Current_page meets the standard and attach value to page
If Current_page>=last_page Then
Page=last_page
ElseIf Current_page<=1 Then
Page=1
Else
Page=current_page
End If
' Previous page
If Page<=0 Then
Prepg=0
Else
Prepg=page-1
End If
' Next page
If Page=last_page Then
Nextpg=0
Else
Nextpg=page+1
End If
' This page begins to record
Firstcount=prepg*everypage_records
' This page closes the record
If Nextpg>=1 Then
Lastcount= (nextpg-1) *everypage_records
Else
Lastcount=total_records
End If
' Start page-navigation bar code
Pagenav= ""
Pagenav1= ""
pagenav=pagenav& "Show <b> &firstcount&"-"&lastcount&" </b> Strip Records total <b> "& total_records& "</b> Record"
pagenav1=pagenav1& "Show <b> &firstcount&"-"&lastcount&" </b> Strip Records total <b> "& total_records& "</b> Record"
If Last_page>1 Then
' When there are front and back pages
pagenav=pagenav& "<a href= '" &url& "page=1 ' > Home </a>"
pagenav1=pagenav1& "<a href= '" &url& "page=1 ' > Home </a>"
If Prepg>=1 Then
pagenav=pagenav& "<a href= '" &url& "page=" &prepg& "' > front page </a>"
pagenav1=pagenav1& "<a href= '" &url& "page=" &prepg& "' > front page </a>"
Else
pagenav=pagenav& "front page"
pagenav1=pagenav1& "front page"
End If
If Nextpg>=1 Then
pagenav=pagenav& "<a href= '" &url& "page=" &nextpg& "' > Back Page </a>"
pagenav1=pagenav1& "<a href= '" &url& "page=" &nextpg& "' > Back Page </a>"
Else
pagenav=pagenav& "Back Page"
pagenav1=pagenav1& "Back Page"
End If
pagenav=pagenav& "<a href= '" &url& "page=" &last_page& "' > Last </a>"
pagenav1=pagenav1& "<a href= '" &url& "page=" &last_page& "' > Last </a>"
pagenav=pagenav& "to <input type=text name=text100 id=text100 value=" &page& "size=3> page <input type= Button name=button100 Value=go > "
pagenav1=pagenav1& "Total" &last_page& "page"
End If
End Sub
%>