• 4872阅读
  • 0回复

文章管理系统的分页程序[supfrie] [复制链接]

上一主题 下一主题
离线XChinux
 

只看楼主 倒序阅读 楼主  发表于: 2005-07-30
<% dim pagenow,totalpage,rss,sql,style

style=request("style")
if trim(style)="" then response.End()
set rss=server.createobject("adodb.recordset")
sql="select * from article where style='"&style&"' order by date desc"
rss.open sql,conn,1,1
pagenow=cint(request("page"))
if pagenow<=0 or pagenow="" then pagenow=1
%>


<%if rss.bof or rss.eof then
response.write("没有记录")
    else
rss.pagesize=10
totalpage=rss.pagecount
    if pagenow>totalpage then pagenow=totalcount
    rss.absolutepage=pagenow
    for i=1 to rss.pagesize
    if rss.eof then exit for
%>
<table width="460" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="1" rowspan="4" background="images/bbg1.gif" bgcolor="#FFFFFF"></td>
<td height="1" background="images/bbg.gif" ></td>
<td width="1" rowspan="4" background="images/bbg1.gif" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> <img src="images/title.gif" width="12" height="10">文章标题:<a href="showarticle.asp?id=<%=rss("id")%>"><font color="#FF0000"><%=rss("title")%></font></a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> 作者:<%=rss("author")%>  浏览次数:<%=rss ("click")%>  <img src="../images/date.gif" width="11" height="11"> 加入日期:<%=rss("date")%></td>
</tr>
<tr>
<td height="1" background="images/bbg.gif" bgcolor="#FFFFFF"></td>
</tr>
</table>
<table width="470" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>


<%
    rss.movenext
    next
    end if%>
<table width="460" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" align="center" width="25%">
<%if pagenow<>1 then %>
<a href=show.asp?page=<%=pagenow-1%>&style=<%=style%>>上页</a>
<% end if%>
</td>
<td valign="middle" align="center" width="25%">
<%if totalpage<>pagenow then%>
<a href=show.asp?page=<%=pagenow+1%>&style=<%=style%>>下页</a>
<%
      end if%>
</td>
<td valign="middle" align="center" width="25%">您在第<%=pagenow%>页</td>
<td valign="middle" align="center" width="25%">共有<%=totalpage%>页</td>
</tr>
</table>
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个