ASP Instance Tutorial: Long article paging feature

Source: Internet
Author: User
Tags manual end

To be dynamic or static. Let me give you the news first. This problem I have been for a long time, you are lucky to have ready-made to you, the following written function
' Manual Paging by identity
function Manualpage (str)
Pages=request. QueryString ("page")
Contentstr=split (str, "{$page $}")
Response.Write (CONTENTSTR (pages))
Response.Write ("<p/>")
Response.Write ("<div class=" "PageList" ">")
For i = 0 To UBound (CONTENTSTR)
Response.Write ("<a href= '? id=" &id& "&page=" &i& "' >" &i+1& "</a>")
Next
Response.Write ("</div>")
End Function


' Paging by length
function AutoPage (str,fontnum)
If Len (str) >fontnum Then
If Len (str) mod fontnum>0 then ' calculate total pages
Pagecontent=len (str) \fontnum+1
Else
Pagecontent=len (str) \fontnum
End If
Dim arr ()
ReDim arr (pagecontent)
for m = 1 to PageContent
If M<>pagecontent Then
Arr (m) = Mid (str, (m*fontnum-fontnum+1), Fontnum)
Else
Arr (m) = Mid (str, (m*fontnum-fontnum+1), Len (str))
End If
Next
If Request.QueryString ("page") <> "then
Response.Write (Arr (Request.QueryString ("page"))
Else
Response.Write (arr (1))
End If
Response.Write ("<p/>")
Response.Write ("<div class=" "PageList" ">")
For i = 1 to PageContent
Response.Write ("<a href=?id=" &id& "&page=" &i& ">" &i& "</a>")
Next
Response.Write ("</div>")
Else
Response.Write (str)
End If
End Function
=============================
In the page
<%
If Instr (Content, "{$page $}") =0 then ' determines whether it is a manual paging flag, not automatic paging
Call AutoPage (content,2000)
Else
Call Manualpage (Content)
End If
%>

Related Article

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.