# <%
# Dim rs, dic
# Set rs = createObject ("adodb. recordset ")
# Rs. open "select * from ctat where aid = 15783", conn
# 'Rs. open "select * from ctat where aid = 12850", conn
#
# Set dic = fAtPgnt (rs ("content"), 50000, request. queryString ("apid "))
# Response. write dic ("pgnt") & "<br/>"
# Response. write dic ("info") & "<br/>"
# Response. write dic ("cnt") & "<br/>"
# Set dic = nothing
# Rs. close
# Set rs = nothing
#
# Function fAtPgnt (aStr, pSize, rId)
#''''''''''''''''''''''''''''''''''''''' '''''''''''''''
# 'Asp generic document paging function (non-record set paging), returns multiple results, dictionary implementation By shawl. qiu
# 'Http://blog.111cn.net/btbtd
#'2017-09-04
#'''''''''''''''''''''''''''
# 'Input parameter description:
# 'Astr is the string to be paged
# 'Psize is the size of each page.
# 'Rid is the URL parameter ID. The default value is apid, which is defined by the rName variable in the function.
#'''''''''''''''''''''''''''
# 'Output parameter description:
# 'Obj ("pgnt") is the link for turning pages
# 'Obj ("info") is the document statistics
# 'Obj ("cnt") is the content of the article
#'''''''''''''''''''''''''''
# 'Sample call:
#'''''''''''''
# 'Dim rs, dic
# 'Set rs = createObject ("adodb. recordset ")
# 'Rs. open "select * from ctat where aid = 15783", conn
#'
# 'Set dic = fAtPgnt (rs ("content"), 50000, request. queryString ("apid "))
# 'Response. write dic ("pgnt") & "<br/>"
# 'Response. write dic ("info") & "<br/>"
# 'Response. write dic ("cnt") & "<br/>"
# 'Set dic = nothing
#'
# 'Rs. close
# 'Set rs = nothing
#''''''''''''''''''''''''''''''''''''''' '''''''''''''''
# If isNumeric (pSize) = false or len (aStr) = 0 then exit function
# If isNull (rId) or rId = "" or isNumeric (rId) = false then rId = 1' if the paging query ID is null, the ID is 1
#
# Dim astrlen' take the variable of the total length of the article
# AStrLen = len (aStr)
#
# 'Intelligent URL string replacement
# Dim rqs, url, rName
# Rqs = request. ServerVariables ("QUERY_STRING ")
# RName = "apid"
# If rqs = "" then
# Url = "? "& RName &" ="
# Elseif instr (rqs, rName) <> 0 then
# Url = "? "& Replace (rqs, rName &" = "& rId," ") & rName &" ="
# Else
# Url = "? "& Replace (rqs," & "& rName &" = "& rId," ") &" & "& rName &" ="
# End if
#
# Dim tPg 'defines the total number of page variables
# TPg = int (aStrLen/-pSize) *-1
#
# If rId <1 then rId = 1' if the paging query ID is less than 1, it is 1
# If cLng (rId)> cLng (tPg) then rId = tPg 'if the page query ID is greater than the total number of pages, the total number of pages is
#
# Dim CCP' defines the variable for getting the start position of the character on the current page
# If rId = 1 then BMP = 1 else CPP = pSize * (rId-1) + 1' start position of reading the article
#
# Dim dic' dictionary variable
# Set dic = createObject ("scripting. dictionary ")
# If aStrLen <= pSize then' if the page size is greater than the body size, perform the following operations:
# Dic. add "pgnt", "" 'add Page connection to dictionary
#
# 'Add statistics to the dictionary
# Dic. add "info", formatNumber (pSize, 0) & "word/page" & rid & "/" & tPg & "page total "&_
# FormatNumber (aStrLen, 0) & "word"
#
# Dic. add "cnt", mid (aStr, 1) 'add content to the dictionary
# Set fAtPgnt = dic
# Set dic = nothing
# Exit function
# End if
#
# Dim I, temp, temp1
# For I = 1 to tPg
# 'If the current query ID = I, add the highlighted CSS class
# If strComp (rId, I, 1) = 0 then temp1 = "class =" "hl """
# Temp = temp & "<a href =" & url & I & "& temp1 &"> page "& I &" </a>"
# Next
#
# Dic. add "pgnt", temp "add page connection to dictionary
#
# 'Add statistics to the dictionary
# Dic. add "info", formatNumber (pSize, 0) & "word/page" & rid & "/" & tPg & "page total "&_
# FormatNumber (aStrLen, 0) & "word"
#
# Dic. add "cnt", mid (aStr, BMP, pSize) 'add the article content to the dictionary
# Set fAtPgnt = dic
# Set dic = nothing
# End function 'awl. qiu code'
# %>