Imitating ASP pages written by PHP

Source: Internet
Author: User
'Paging program
'Total_records total number of records
'Everypage_records: Number of Entries displayed per page
'Current_page current page number
'URL: the url to be passed. The variable to be passed can be contained here, for example, "list. asp? "Or" list. asp? Keyword = key &"
'The program call is relatively simple, but it is still more troublesome than PHP. Continue to work hard.
Sub show_page (total_records, everypage_records, current_page, url)
If IsNumeric (total_records) then
Total_records = Int (total_records)
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
Everypage_records = 10
End if

If IsNumeric (current_page) then
Current_page = Int (current_page)
Current_page = 1
End if

'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)
Last_page = Int (total_records/everypage_records) + 1
End if

'Determine whether current_page meets the criteria and attach the value to the page
If current_page> = last_page then
Page = last_page
Elseif current_page <= 1 then
Page = 1
Page = current_page
End if

'Previous page
If page <= 0 then
Prepg = 0
Prepg = page-1
End if
'Next page
If page = last_page then
Nextpg = 0
Nextpg = page + 1
End if

'Start record on this page
Firstcount = prepg * everypage_records
'End record of this page
If nextpg> = 1 then
Lastcount = (nextpg-1) * everypage_records
Lastcount = total_records
End if
'Start pagination navigation bar code
Pagenav = ""
Pagenav1 = ""
Pagenav = pagenav & "display the total number of <B>" & firstcount & "-" & lastcount & "</B> records <B>" & total_records & "</B> records"
Pagenav1 = pagenav1 & "display the total number of <B>" & firstcount & "-" & lastcount & "</B> records <B>" & total_records & "</B> records"
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.