Now there is no problem in generating static pages from them, but how to generate static files with numbers like 20030405-1.htm 20030405-2.htm 20030405-3.htm according to certain rules? A friend from CSDN answered it last time, so I copied it. The original text is as follows
===========================
Use statistics on the word count of articles, and then truncate the output when it reaches a certain word count, but the paginated content will be truncated in inexplicable places, which is not very friendly.
It's very simple, look for the following symbol near the place you want to truncate:
;'? . ! ;'.!
If there is <p> or <br> behind it, page break. The main thing is to study the format of the article.
<%
if Request.ServerVariables(Content_Length) > 0 then
content = Request.Form(textarea1)PageLength = 1000 'Number of words per page
CLength = Len(content)
PageCount = Int(Clength/PageLength) + 1 'Calculate the number of pages dim PageArray
redim PageArray(PageCount)Seperator = Array(chr(13),chr(10),.,!,?,;,,,,') 'Separator PageArray(0) = 0
Pos = 0
for j=0 to ubound(Seperator)
Pos = instr(PageArray(i)+900,content,Seperator(j)) 'The position near PageArray(i)+900 is 100 words, 1-999 is adjustable
while Pos > 0 and Pos < (i+1)*PageLength and Pos > i*PageLength
PageArray(i) = Pos
Pos = instr(Pos+PageLength,content,Seperator(j))
wendif PageArray(i) > 0 then
Response.Write 0:i¦ &PageArray(i)&<br>&j&:j&Seperator(j)&<br>
j = j + ubound(Seperator) + 1
end if
nextfor i=1 to PageCount-1
PageArray(i) = 0
Pos = 0
for j=0 to ubound(Seperator)
Pos = instr(PageArray(i-1)+950,content,Seperator(j))
while Pos > 0 and Pos < (i+1)*PageLength and Pos > i*PageLength
PageArray(i) = Pos
Pos = instr(Pos+PageLength,content,Seperator(j))
wend
if PageArray(i) > 0 then
Response.Write i&:i¦ &PageArray(i)&<br>&j&:j&Seperator(j)&<br>
j = j + ubound(Seperator) + 1
end if
next
nextoutput = mid(content,1,PageArray(0))
output = replace(output,chr(13),<br>)
Response.Write <br><br>Paragraph 1<br>
Response.Write outputfor i=1 to PageCount-2
output = mid(content,PageArray(i-1)+1,PageArray(i)-PageArray(i-1))
output = replace(output,chr(13),<br>)
Response.Write <br><br>Paragraph &i+1&<br>
Response.Write output
The output of next' last paragraph is not written else.
%>
<FORM action= method=POST id=form1 name=form1>
<TEXTAREA rows=70 cols=120 id=textarea1 name=textarea1>
</TEXTAREA>
<INPUT type=submit value=Submit id=submit1 name=submit1>
</FORM>
<%end if%>
-------------------------------------------------- -------------
Define the length of each page MaxLength
Total text lengthTotalLength
Scan for hard returns at the end of each paragraph in the article
and calculate the length
Once it exceeds MaxLength, it will be divided into the first page.
Delete the part before this hard return and repeat the above operation.