Long articles use pagination characters for pagination (implemented by ASP)
Source: Internet
Author: User
Long article pages are displayed by pagination. 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. However, this method
There is a BUG, that is, if UBB code is included in your article content, it can easily cause paging between [code] [/code], or
Simply break down the [code] into [co and de], so that the article will show errors.
The following steps can be fully implemented.
Step 1:
Follow the normal article system, add articles in the background, search articles, and detailed pages of articles.
This is not described here. Please refer to relevant posts. When you add an article, add the pagination character "|" to the page where you want it to be paged"
(Of course, you can use this symbol at will, such as [page], &, ###,…, As long as it is not displayed normally in the article
.)
I used four pages: index. asp, add. asp, view. asp, and
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
A displasy. asp. All paging code is here.
Step 2:
In the dynamic data section of the text, the following code and explanation are provided:
<%
'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, "| ")
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