Long article uses pagins to display (ASP implementation)

xiaoxiao2021-03-06  48

The long article page uses the page character to display, you want to use ASP to implement this function, you can find that only the method according to the number of words, but this method

There is a bug, if you have a UBB code in your article, it is easy to cause paging between [CODE] [/ CODE], or

Decompose [CODE] into [CO and DE], this article shows an error.

The following steps will be fully implemented.

first step:

According to the normal article system, do it all the way, the background of the background, the search, and the detailed page of the article, is a regular way

For example, you don't add a description, please refer to related posts. Just add a pagan when you want it to add a pagination: "|||"

(Of course this symbol you can use, such as: [Page], &&&, ###, @@@ ......, as long as it doesn't have the normal display of the article

The party will appear. I used four pages, enter the page (index.asp), enter the completion page (add.asp), article list page (View.asp), article

Content page (Display.asp), the top three are not to process, see the picture below, I think the general bird will do it, the key is the last

A Displasy.asp, all the code that implements paging is here.

Step 2:

Do some hands and feet in the dynamic data part of the text content of the article, the following is the code and explanation:

<% 'Here to handle the received paging parameters to show the content of the shorter page' below, ' "Page" = "" "" "" ") Otherwise, the variable assigns the parameters of the passage of Page to display other pages elsepagenum = request (" page ") end if%> <% 'If an optional execution UBB code, you can add the following code 'RS ("noubb") is a field about disabling UBB, 0 is disabled, 1 is to perform IF RS ("NoubB") = 0 Then' to avoid the article contents Error, use the Replace function to add a full-angle 'RS ("content") in the database with the replace function, add a field of the text, add UBB or disable ubbcontent = replace ((UNHTML (RS "Content"))), "|||", "||") Elseif RS ("Noubb") = 1 Tencontent = Replace ((Ubb (RS (""))), "|||", "|||") end if%> <% 'This is the key "We use the split function to remove the article segmentation in the file contentstr = split (content," ||| ")' to get from the URL parameter To display the variable of that, it will be circulated for i = Pagenum to Pagenum%> <% = contentstr%> <% next%> This article is divided into <% 'paged place, and use Ubound (ContentStr) to divide a total of a total of a total of a total, note that it starts from 0, Therefore, the total number of pages needs to add 1for p = 0 to ubound (contentstr) 'link or this page, but the article ID parameters should be added to the parameters: Page%> & Page = <% = p%> "class ="> <% = p 1%> <% next%> page is simple, if you take the comment All delete, only 15 lines of code, but also processed, let it have a previous page, the next page and the current page outstanding function is perfect.

Tested, unless the paginist appeared in the article, all types will not be wrong, of course, can increase the number of |||, such as: ||||||, then six "|" The following appears in the article Nothing, but six or more will be paised, choose a good paging method.

转载请注明原文地址:https://www.9cbs.com/read-80814.html

New Post(0)