Note that the spaces in the middle of [Page] need to be deleted. Because it is the same as the background page of the home of the feet, a space is added for processing.
Just inArticleAdd the "[Page]" in the place where you want it to be paged. (Of course, you can use this symbol as needed, for example: [Page], &, ###, @…, As long as it does not appear where the article is to be normally displayed .)
I used four pages and input pages (index. ASP. ASP), article list page (view. ASP), article content page (text. ASP), the first three are non-processing pages, see the following introduction I think the general bird will do, the key is the last text. ASP, all implement PagingCodeAll here.
Step 2: Come
In the dynamic data section of the text, the following code and explanation are provided:
Copy code The Code is as follows: 'Here is the code for processing paging.
'For the sake of filtering insurance, we use the replace function to add a space before and after the paging code.
Mmtext = Replace (RS ("contents"), "[Page]", "[Page]")
Mmftext = Split (mmtext, "[Page]")
'Use the ubound function to obtain the number of pages to be split. Note that the base value starts from 0.
Contentnum = ubound (mmftext)
Page = clng (Request ("page "))
If page <1 then
Page = 1
End if
'To look more intuitive, we set the start page to 1, then the total number of pages must be increased by 1.
If page> contentnum + 1 then
Page = contentnum + 1
End if
'The variable obtained from the URL parameter above to be displayed will be displayed cyclically
For I = page to page
Response. Write mmftext (I-1)
Next
'List pagination
If CINT (contentnum)> 0 then
If page <> 1 then
Response. Write "<a href = 'text. asp? Id = "& request (" ID ") &" & page = "& page-1 &" '> [Previous Page] </a>"
End if
'Remember that the value of the lower Mark starts from 0. Here we start from 1 and Add 1 to the total number.
For p = 1 to contentnum + 1
If page = p then
Response. Write "<a href = 'text. asp? Id = "& request (" ID ") & "& page =" & P & "'> <font color = Red> [" & P & "] </font> </a>"
Else
Response. Write "<a href = 'text. asp? Id = "& request (" ID ") &" & page = "& P &" '> ["& P &"] </a>"
End if
Next
If page <> contentnum + 1 then
Response. Write "<a href = 'text. asp? Id = "& request (" ID ") &" & page = "& page + 1 &" '> [Next Page] </a>"
End if
End if
The following is an article on other websites. For more information, see.
Long article pages are displayed with pagination characters. If you want to use ASP to implement this function, you can find that only the paging method is based on the number of words, but this method has a bug, if UBB code is included in your article, it will easily cause paging between [Code] [/Code, or simply break down [Code] into [Co and de], so that the article will show errors.
The following steps can be fully implemented.
Step 1:
Follow the steps in the normal Article system, add articles in the background, search articles, and detailed pages of articles, which are common operations. Here, we do not add a description. For more information, see related posts. When you add an article, add the pagination character "|" to the place where you want it to be paged. (Of course, you can use this symbol at will, for example: [Page], &, ###, @…, As long as it does not appear where the article is to be normally displayed .)
I used four pages and input pages (index. ASP. ASP), article list page (view. ASP), article content page (display. ASP), the first three are non-processing pages, look at the following picture I think the average bird will do, the key is the last displasy. ASP. All code that implements paging is here.
Step 2:
In the dynamic data section of the text, the following code and explanation are provided: Copy code The Code is as follows: <%
'Here we need to process the received paging parameters to display the page number.
'The following two sentences show the value of the first page of the variable pagenum if there is no page parameter.
If request ("page") = "" then
Pagenum = 0
'Otherwise, the variable is assigned a parameter in the passed page to display other pages.
Else
Pagenum = request ("page ")
End if
%>
<%
'If you have added the optional UBB code, you can add the following code:
'Rs ("noubb") is the field about disabling UBB in the database. 0 indicates disabled, and 1 indicates execution.
If RS ("noubb") = 0 then
'To avoid an error when connecting to the article content, use the replace function to add a fullwidth before and after the paging code "| ".
'Rs ("content") is the body field of the database. Add UBB or disable UBB here.
Content = Replace (unhtml (RS ("content"), "|", "| ")
Elseif RS ("noubb") = 1 then
Content = Replace (UBB (RS ("content"), "|", "| ")
End if
%>
<%
'Here is the key.
'Use the split function to extract the article and store the variable content in segments.
Contentstr = Split (content, "| ")
'According to the variable you just obtained from the URL parameter that you want to display, a page is displayed cyclically.
For I = pagenum to pagenum
%>
<! -- Here is the body of the article -->
<% = Contentstr %>
<% Next %>
</TD>
</Tr>
<Tr>
<TD Height = "30" class = "classname"> This article is divided
<%
'Place by PAGE, use ubound (contentstr) to get the article into several pages. Note that this is from 0, so the total number of pages needs to be increased by 1.
For p = 0 to ubound (contentstr)
'The link is still the current page, but a paging parameter is added after the article Id parameter: Page
%>
<A href = "display. asp? Id = <% = rsquest ("ID") %> & page = <% = P %> "class =" "> <% = P + 1%> </a>
<% Next %> page
It's easy. If you delete all the comments, only 15 lines of code will be available. However, you have to work it out so that it can have the outstanding functions of the previous page, the next page, and the current page.
Tested, unless the paging character appears in the article, there will be no errors in various types. Of course, you can increase the number of ||||||, the next six "|" and below are all okay in the article, but more than six will be paged, And you can select a good paging character.