In the past two days, I used my free time to program and thought about the simple implementation methods of pagination and page number bars for long articles.
The idea is VBSCRIPT.
CurrentPage=Request.QueryString("page")
'CurrentPage means the current page
PageCount = Int(Len(Content)/SIZE) + 1
'Content is a long article content
'SIZE is the number of words displayed on each page
'PageCount is the page number of the last page
START=Cint((CurrentPage-1)*SIZE+1)
'START is the starting number of words on each pageIf
START<1 Then START=1
Content=Mid(Content,START,SIZE)
'The text on each page is cut out above
' and below is the page number bar. It's a fantasy, but it's quite simple and practical. . . I think it's enough for general paging.
'PAGEBAR_COUNT means how many page numbers are displayed each time. It's not very accurate because I divided it by two and rounded it up (cough, it's almost ok, haha)
PageBar="<br/><a href="""&FileName&"?act=View&id="&ID&"&Page=1"">[<<]</a>"
For i=CurrentPage-Cint(PAGEBAR_COUNT/2) to CurrentPage+Cint(PAGEBAR_COUNT/2)
If i>0 and i<=PageCount Then PageBar=PageBar&"<a href="""&FileName&"?act=View&id="&ID&"&Page="&i&""">["&i&"]</a>"
Next
PageBar=PageBar&"<a href="""&FileName&"?act=View&id="&ID&"&Page="&PageCount&""">[>>]</a>"
Source: Sipo Blog
http://www.dc9.cn/post/272.html