<!--#include file="Inc/Conn.asp"-->
<!--#include file="Inc/eshopcode.asp"-->
<!--#include file="Inc/Code.asp"-->
<!--#include file="Head.asp"-->
<%
If Request.QueryString("tit")="" Then 
If Request.Form("cndok")="Go" Then Response.Redirect "News.asp?page="&Trim(Request.Form("pp"))
Else
If Request.Form("cndok")="Go" Then Response.Redirect "News.asp?tit=" &Trim(Request.QueryString("tit"))& "&page="&Trim(Request.Form("pp"))
End if
Set bb=Conn.Execute("Select * From [BigClassNews]")
titel = bb("News_BigClassName")

sqlstr = " Select * From [News] "
If Request.QueryString("tit")="" Then
sqlstr = sqlstr & " Where [News_BigClassName]='"&titel&"' "
Else
sqlstr = sqlstr & " Where [News_BigClassName] = '"&checkstr(Request.QueryString("tit"))&"' " 
End if
Set rs=Server.CreateObject("ADODB.RecordSet") 
rs.Open sqlstr,conn,1,1

dim MaxPerPage
MaxPerPage=20

Dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
Function PNews()
Dim PNewHtml
Set big=Conn.Execute("Select * From [BigClassNews]")
If big.Eof Then
PNewHtml=PNewHtml& "没有该类别!"
Else
Do While Not big.Eof
PNewHtml=PNewHtml& "<img src='ziyan/folder.gif'> <a href=TNews.asp?tit=" &big("News_BigClassName")& ">" &big("News_BigClassName")& "</a><br>"
set rsSmallClass=server.CreateObject("adodb.recordset")
rsSmallClass.open "Select * From [SmallClassNews] Where [News_BigClassName]='" & big("News_BigClassName") & "'",conn,1,1
do while not rsSmallClass.eof
PNewHtml = PNewHtml & "<img src='ziyan/page.gif'> <a href=TNews.asp?tit="&big("News_BigClassName")&"&ttit="&rsSmallClass("News_SmallClassName")&">"&rsSmallClass("News_SmallClassName") & "</a><br>"
rsSmallClass.movenext
loop	
big.MoveNext
Loop
End if
Pnews=PnewHtml
End Function
Dim PTit
If Request.QueryString("tit")="" Then
PTit= rs("News_BigClassName")
Else
PTit = Request.QueryString("tit")
End if
Function PNewsList()
Dim PnHtml
If rs.eof and rs.bof then
PnHtml = PnHtml & "没有该类别!"
Else
i=0
Do While Not rs.Eof
ti = rs("Titel")
If Len(ti)>30 Then ti=Left(ti,30) & "..."
PnHtml = PnHtml & "<table width=100% border=0 cellspacing=0 cellpadding=2>"
PnHtml = PnHtml & "<tr>" 
PnHtml = PnHtml & "<td><img src=Image/article_common.gif width=9 height=15>"
PnHtml = PnHtml & "<a href=ShowNews.asp?id="&rs("News_ID")&"> "&ti&" </a>" 
PnHtml = PnHtml & "("&rs("InfoTime")&","&rs("Hits")&") </td>"
PnHtml = PnHtml & "</tr>"         
PnHtml = PnHtml & "</table>"
i=i+1 
If i >= MaxPerpage Then Exit do 
rs.MoveNext
Loop
End if
PNewsList=PnHtml
End Function
Dim PNewsFen
PNewsFen = PNewsFen & "共 <font color='#ff0000'>" & Cstr(Rs.RecordCount) & "</font> 条信息&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
PNewsFen = PNewsFen & "第 " & Cstr(CurrentPage) & "/" & Cstr(rs.pagecount) & "&nbsp;"
If currentpage > 1 Then
If Request.QueryString("tit")="" Then 
PNewsFen = PNewsFen & "<a href='News.asp?page="+cstr(1)+"'>首页 </a>&nbsp;"
PNewsFen = PNewsFen & "<a href='News.asp?page="+Cstr(currentpage-1)+"'> 上一页 </a>&nbsp;"
Else
PNewsFen = PNewsFen & "<a href='News.asp?tit=" &Trim(Request.QueryString("tit"))& "&page="+cstr(1)+"'>首页 </a>&nbsp;"
PNewsFen = PNewsFen & "<a href='News.asp?tit=" &Trim(Request.QueryString("tit"))& "&page="+Cstr(currentpage-1)+"'> 上一页 </a>&nbsp;"
End if
Else
PNewsFen = PNewsFen & " 上一页 "
End if
If currentpage < Rs.PageCount Then
If Request.QueryString("tit")="" Then 
PNewsFen = PNewsFen & "<a href='News.asp?page="+Cstr(currentPage+1)+"'> 下一页</a>&nbsp;"
PNewsFen = PNewsFen & "<a href='News.asp?page="+Cstr(Rs.PageCount)+"'> 尾页</a>&nbsp;&nbsp;"
Else
PNewsFen = PNewsFen & "<a href='News.asp?tit=" &Trim(Request.QueryString("tit"))& "&page="+Cstr(currentPage+1)+"'> 下一页 </a>&nbsp;"
PNewsFen = PNewsFen & "<a href='News.asp?tit=" &Trim(Request.QueryString("tit"))& "&page="+Cstr(Rs.PageCount)+"'> 尾页</a>&nbsp;&nbsp;"
End if
Else
PNewsFen = PNewsFen & "下一页&nbsp;&nbsp;"
End if
PNewsFen = PNewsFen & "</td><td align='right'>"
PNewsFen = PNewsFen & "转到：<input type='text' name='pp' size=4 maxlength=4 class=smallInput value="&Currentpage&">&nbsp;"
PNewsFen = PNewsFen & "<input type='submit'  value='Go'  name='cndok'>&nbsp;&nbsp;"
Dim NewsHtml
NewsHtml=application("JaNews")
NewsHtml=Replace(NewsHtml,"{用户登陆}",UserLogin())
NewsHtml=Replace(NewsHtml,"{用户搜索}",FindProd())
NewsHtml=replace(NewsHtml,"{新闻信息}",TopNews("News_ID"))
NewsHtml=Replace(NewsHtml,"{新闻分类}",PNews())
NewsHtml=Replace(NewsHtml,"{用户投票}",ShowVote())
NewsHtml=Replace(NewsHtml,"{用户位置}",PTit)
NewsHtml=Replace(NewsHtml,"{新闻列表}",PNewsList())
NewsHtml=Replace(NewsHtml,"{新闻分页}",PNewsFen)
Response.Write NewsHtml
rs.close
set rs=nothing
%>
<!--#Include File="bottom.Asp"-->