SoFunction
Updated on 2025-03-02

Add paging function to the news system of Wanbo system [with detailed description]

Add paging function to the news system of Wanbo system, without modifying the database, just change a file, and it's fine.
If you add an insert page break in the background Webediter, it will be even more perfect. I haven't added this yet.

This example is to insert page breaks when entering news in the background: {$html_page$} at the location where the page is required.

The code is as follows, with detailed description


<!--#include file=""-->
<HTML>
<HEAD>
<TITLE><%=sitename%></TITLE>
<META HTTP-EQUIV="Content-Type" C>
<link href="images/" type=text/css rel=stylesheet>
</HEAD>
<body  topmargin="0">
<table width="780" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="3"><!--#include file=""--></td>
  </tr>
  <tr>
    <td width="145" align="left" valign="top"><!--#include file="" --></td>
    <td align="left" valign="top" ><table width="625"  border="0" cellspacing="0" cellpadding="0">

        <tr>
          <td width="17" height="20"> </td>
          <td width="598"> </td>
          <td width="10"> </td>
        </tr>
        <tr >
          <td width="17"><% idd=trim(("id"))
             set rsr=("")
             sql="select * from News where  Putout=true and Newcontent")
    Newtitle=rsr("Newtitle")
                Putman=rsr("Putman")
    kig=rsr("kig")
    kig=kig+1
    addtime=rsr("addtime")  
    rsr("kig")=kig
    
    else
"The record cannot be found, and a common source error has occurred. Please contact the administrator!"
    end if  
'The received paging parameters are processed here to display the content of the page
'The following two sentences are: If the parameter page is not passed, let the variable pageNum take the value of the first page: 0
If Request("page")="" Then
pageNum=0
'Otherwise, assign the variable as the parameters in the passed page to display other pages
Else
pageNum=Request("page")
End if
%>
<%
'If you add optional execution UBB code, you can add the following code
'rs("NoUBB") is the field in the database about disabling UBB. 0 is disabled and 1 is executed.
'If rsr("NoUBB")=0 then
'To avoid errors in connection with the article content, use the Replace function to add a full-width front and back of the pagination code "{$html_page$}"
'rs("content") is a field in the database text, add UBB here or disable UBB
Content=Replace(Newcontent,"{$html_page$}"," {$html_page$} ")
'Elseif rsr("NoUBB")=1 then
'Content=Replace((ubb(Newcontent)),"{$html_page$}"," {$html_page$} ")
'End if
%></td>
          <td height="22" align="center" class="NEWS_title"><%=Newtitle%><br>
<hr size="1" noshade  color="#666666"></td>
          <td width="10"> </td>
        </tr>
        <tr>
          <td rowspan="3"> </td>
          <td height="303" valign="top" ><%
'This is the key
'We use the split function to extract the article segments and save it into the variable content
ContentStr=split(Content,"{$html_page$}")
'According to the variable that you want to display from the URL parameters just now, just loop to display a page
For i=pageNum to pageNum
%>
<!--This will be the main content of the article-->
<%=ContentStr(i) %>
<% Next %></td>
          <td rowspan="3"> </td>
        </tr>
        <tr>
          <td height="8" valign="top">  </td>
        </tr>
        <tr>
<td height="8" align="center" valign="top">This article is divided into
<%
'In the page, use ubund(ContentStr) to get the article into several pages. Note that it starts from 0, so the total number of pages needs to be added to 1.
For p = 0 to ubound(ContentStr)
'The link is still this page, but the article ID parameter must be added with a pagination parameter: page
%> 
<a href="?ID=<%=request("ID")%>&page=<%=p%>" class=""><%=p+1%></a>
<% Next %>Page</td>
        </tr>
        <tr>
          <td height="40"> </td>
          <td height="60" valign="bottom"><table width="100%"  border="0" cellpadding="5" cellspacing="1" bgcolor="#CECECE">
            <tr bgcolor="#FFFFFF" >
<td width="16%" align="right" bgcolor="#CECECE" >Publisher:</td>
              <td width="20%" bgcolor="#FFFFFF"> <%=Putman%></td>
<td width="15%" align="right" bgcolor="#CECECE">Add time:</td>
              <td width="20%" bgcolor="#FFFFFF"> <%=addtime%></td>
<td width="15%" align="right" bgcolor="#CECECE">Tap   Number of hits:</td>
              <td width="15%"><%=kig%></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
    </table></td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="3"><!--#include file=""--></td>
  </tr>
</table>
</body>
</html>