<!--#include file="include/buyok_shop_30_conn.asp" -->
<%
call aspsql()
action=trim(request("class"))
Set rs = conn.Execute("select * from shopsetup") 
title=rs("newstitle"&action)
if title="" then response.redirect "news_home.asp"
set rs=nothing
pages=30
%>
<HTML>
<HEAD>
<TITLE>新闻中心 - <%=title%></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="description" content="<%=sitedescription%>">
<meta name="keywords" content="<%=sitekeywords%>">
<link rel="stylesheet" href="buyok_shop.css" type="text/css">
</HEAD>
<center>
<!--#include file="buyok_top.asp"-->
<table width="760" border=0 cellspacing=0 cellpadding=0 align=center bgcolor="#FFFFFF"  class="grayline">  
<tr><td bgcolor="FFFBF7" align=center valign=top width=185> 
<!--#include file="buyok_login.asp" -->
<!--#include file="buyok_tree.asp" -->
</td>
<td bgcolor="#CCCCCC" width="1"></td>
<td width=569 align=center valign=top>
<table cellspacing=0 cellpadding=0 width=566 bgcolor=#FFFFFF border=0 class="new" align="center">
<tbody><tr><td  height=30>目前位置：<a href=main.asp>首页</a> > <a href="news_home.asp">新闻中心</a> > <%=title%></td></tr> 
<tr><td height="1" background="images/small/bgline.gif"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td width=98% valign=top>
<table border=0  width=165>
<tr><td width=165 height=28 background=images/small/newsbar.gif align=center><%=title%></td></tr>
</table>
<table cellpadding=2 cellspacing=0 border=0  width=95% align=center bgcolor=#FFFFFF>
<%
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from News where online=true and now()<OffDate and now()>=PubDate and NewsClass='"&action&"'  order by uup desc,Pubdate desc"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write "<tr><td height=50 align=center>暂时没有新闻文章</td></tr>"
else
rs.pageSize = pages '每页记录数
allPages = rs.pageCount	'总页数
page = Request("page")	'从浏览器取得当前页

'if是基本的出错处理

If not isNumeric(page) then page=1

if isEmpty(page) or clng(page) < 1 then
page = 1
elseif clng(page) >= allPages then
page = allPages 
end if
rs.AbsolutePage = page			'转到某页头部
do while not rs.eof and pages>0
%>
<tr><td width=55%>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="news.asp?NewsId=<%=rs("NewsId")%>"><%=lleft(rs("NewsTitle"),40)%></a></td>
<td width=25%><%=rs("PubDate")%></td><td width=20%>人气值：<%=rs("cktimes")%></td></tr>
<%
pages = pages - 1
rs.movenext
if rs.eof then exit do
loop

end if
%>
</table>
</td></tr>

<%
call listpage()
%>

</table>
</td></tr>
</table>
<!--#include file="buyok_down.asp"-->
</CENTER>
</BODY>
</HTML>
<%
sub listpage()
'if allpages<=1 then exit sub
response.write "<tr><td height=30> </td></tr><tr><td colspan=3 height=1 background=images/small/bgline.gif></td></tr>"
response.write "<tr><td align=center>"
response.write "<br>总计 "&RS.RecordCount&" 篇文章 &nbsp;"
if page = 1 then
response.write "<font color=darkgray>首页 前页</font>"
else
response.write "<a href=news_home_more.asp?class="&action&"&page=1>首页</a> <a href=news_home_more.asp?class="&action&"&page="&page-1&">前页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下页 末页</font>"
else
response.write " <a href=news_home_more.asp?class="&action&"&page="&page+1&">下页</a> <a href=news_home_more.asp?class="&action&"&page="&allpages&">末页</a>"
end if
response.write " &nbsp; 第"&page&"页 共"&allpages&"页 </td></tr>"
end sub

rs.close
set rs=nothing
conn.close
set conn=nothing
%>
