Add paging function to the news system of the Huambo system [with detailed description]_asp Foundation

Source: Internet
Author: User
Tags add time
The news system to the Huambo system to increase paging function, without modifying the database, just change a file, it is OK.
It's even more perfect if you add a webediter to the background. I haven't added this yet.

This example is in the background to enter the news, in the need to page the location Insert page break: {$html_page$} on it.

The code is as follows, with detailed instructions
Newsshow.asp

<!--#include file= "siteinfo.asp"-->
<HTML>
<HEAD>
<TITLE><%=sitename%></TITLE>
<meta http-equiv= "Content-type" c>
<link href= "Images/css.css" Type=text/css rel=stylesheet>
</HEAD>
<body topmargin= "0" >
<table width= "780" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
&LT;TD colspan= "3" ><!--#include file= "top.asp"--></td>
</tr>
<tr>
&LT;TD width= "145" align= "left" valign= "top" ><!--#include file= "left.asp"--></td>
&LT;TD align= "left" valign= "top" ><table width= "625" border= "0" cellspacing= "0" cellpadding= "0" >

<tr>
&LT;TD width= "height=" > </td>
&LT;TD width= "598" > </td>
&LT;TD width= "Ten" > </td>
</tr>
<tr >
&LT;TD width= "><% Idd=trim" (Request.QueryString ("id"))
Set Rsr=server.createobject ("Adodb.recordset")
Sql= "SELECT * from News where putout=true and id=" &idd
Rsr.open sql,conn,1,3
If not rsr.eof then

NEWCONTENT=RSR ("Newcontent")
NEWTITLE=RSR ("Newtitle")
PUTMAN=RSR ("Putman")
KIG=RSR ("Kig")
Kig=kig+1
ADDTIME=RSR ("Addtime")
RSR ("Kig") =kig
Rsr.update
Else
Response. Write "Can not find a record, a guide error, please contact the administrator!" "
End If
' This is where you want to process the paging parameters that you receive to display the contents of the page
' The next two sentences are that if there is no page, let the variable pagenum take the value of the first page: 0
If Request ("page") = "" Then
Pagenum=0
' Otherwise assign the variable to the argument in the page that is passed, to display the other pages
Else
Pagenum=request ("page")
End If
%>
<%
' If you add the optional execute UBB code, you can add the following code
' RS (' Noubb ') is a field in the database about disabling UBB, 0 is disabled, and 1 is executing
' If rsr (' Noubb ') =0 Then
' To avoid errors associated with the content of the article, use the Replace function to add a full angle to the front and back of the paging code ' {$html_page$} '
' RS (' content ') is the text field in the database, where you add Ubb 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>
&LT;TD height= "align=" "Center" class= "News_title" ><%=Newtitle%><br>
&LT;HR size= "1" noshade color= "#666666" ></td>
&LT;TD width= "Ten" > </td>
</tr>
<tr>
&LT;TD rowspan= "3" > </td>
&LT;TD height= "303" valign= "Top" ><%
' This is the key.
' We use the Split function to separate the article into the variable content.
Contentstr=split (Content, "{$html_page$}")
' In accordance with the variable that you have just obtained from the URL parameter to show that side, loop the page
For I=pagenum to Pagenum
%>
<!--here will be the content of the article body-->
<%=contentstr (i)%>
<% Next%></td>
&LT;TD rowspan= "3" > </td>
</tr>
<tr>
&LT;TD height= "8" valign= "Top" > </td>
</tr>
<tr>
&LT;TD height= "8" align= "center" valign= "Top" > This article is divided into
<%
' Pagination place, with UBound (CONTENTSTR) to get the article is divided into several pages, note that this is starting from 0, so the total number of pages need to add 1
For p = 0 To UBound (CONTENTSTR)
' Link or this page, but after the article ID parameter also add a paging parameter: page
%>
<a href= "Newsshow.asp?id=<%=request" ("ID")%>&page=<%=p%> "class=" "><%=p+1%></a>
<% Next%> page </td>
</tr>
<tr>
&LT;TD height= > </td>
&LT;TD height= valign= "Bottom" ><table width= "100%" border= "0" cellpadding= "5" cellspacing= "1" bgcolor= "# Cecece ">
<tr bgcolor= "#FFFFFF" >
&LT;TD width= "16%" align= "right" bgcolor= "#CECECE" > Publisher:</td>
&LT;TD width= "20%" bgcolor= "#FFFFFF" > <%=Putman%></td>
&LT;TD width= "15%" align= "right" bgcolor= "#CECECE" > Add time:</td>
&LT;TD width= "20%" bgcolor= "#FFFFFF" > <%=addtime%></td>
&LT;TD width= "15%" align= "right" bgcolor= "#CECECE" > clicks:</td>
&LT;TD width= "15%" ><%=kig%></td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
&LT;TD colspan= "3" ><!--#include file= "bot.asp"--></td>
</tr>
</table>
</body>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.