Last time I wrote a long PHP article pagination code used to explode to the implementation of segmentation, today we talk about ASP article pagination code and long article pagination and ASP long article pagination method.
Function c2u (MyText)
Dim I
c2u = ""
For i = 1 to Len (MyText)
c2u = c2u & "& #x" & Hex (AscW (Mid (MyText, I, 1)) & ";"
Next
End Function
Function Cutstr (Str,strlen)
' Remove all HTML tags
Dim RE
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "< (. [ ^>]*) > "
Str=re. Replace (str, "")
Set re=nothing
Dim L,t,c,i
L=len (str)
T=0
For I=1 to L
C=abs (ASC (str,i,1))
If c>255 Then
T=t+2
Else
T=t+1
End If
If T>=strlen Then
Cutstr=left (str,i) & "..."
Exit for
Else
Cutstr=str
End If
Next
Cutstr=replace (CUTSTR,CHR (10), "")
Cutstr=replace (CUTSTR,CHR (13), "")
End Function
Function converttowide (str)
Dim strlen
Dim position
Dim Convertstr
If IsNull (str) Then
Converttowide=str
Else
Position=1
Strlen=len (str)
For I=1 to Strlen
convertstr=convertstr+ "& #x" +hex (AscW (Mid (str,position,1)) + ";"
Position=position+1
Next
Converttowide=convertstr
End If
End Function
Dim Topicx,usernamex,addtimex,logtextx,ispassword
' Get ID number
Articleid=request ("ArticleID")
' Write execution statement
strSQL = "SELECT * from article where articleid=" &articleid& ""
' Connect the function above
Logtextx=cutstr (RS ("content"), 5000)
' Start paging
Dim page,pagelength,clength,pagecount,wen,a
If Request ("page") <> "then page = CLng (Request (" page ")
Pagelength = 80
Clength = Len (LOGTEXTX)
PageCount = Int (clength/pagelength) + 1
If page < 1 or IsNull (page) Then page = 1
If page > PageCount Then page = PageCount
If Page=1 Then
A=1
ElseIf Page>1 Then
A= (Page-1) *pagelength
End If
Wen=mid (Logtextx,a,pagelength)
' Judge
If page= "" or page=1 Then
' Start displaying content
Response.Write (C2u ("Content:")) ' www.w3sky.com
End If
Response.Write (Converttowide (Wen))
Response.Write "<br/>"
' Response.Write (Converttowide ("Word of the article:")) & Clength & "<br/>"
Response.Write (C2u ("This article is divided into")) & PageCount & (Converttowide ("page")) & "" &c2u ("Current" &Page& "page") & "< br/>"
If PageCount >1 and page <> 1 Then ' www.w3sky.com
Response.Write "1"
End If
Dim j
For J=page+1 to Page+10
If J <= PageCount-1 Then
Response.Write "" &j& ""
End If
Next
If PageCount >1 and Page <> PageCount Then
Response.Write "<a href="/"showarticle.asp?articleid=" &articleid& "&page=" &PageCount& "" " > "&PageCount&" </a><br/> "
End If
' End