<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<%
dim rs,sql,classid,bytype,num,max
if(request.QueryString("classid")<>"") then
	classid=Cint(request.QueryString("classid"))
else
	classid=0
end if
if(request.QueryString("bytype")<>"") then
	bytype=Cint(request.QueryString("bytype"))
else
	bytype=0
end if
if(request.QueryString("num")<>"") then
	num=Cint(request.QueryString("num"))
else
	num=10
end if
if(request.QueryString("max")<>"") then
	max=Cint(request.QueryString("max"))
else
	max=10
end if
sql="select top "&num&" n.id as nid,n.title,n.pagepath,c.count from news as n,news_count as c where c.articleid=n.id and n.checked=true"
if(classid<>0) then
	sql=sql&" and n.classid="&classid
end if
if(bytype<>0) then
	if(bytype=1) then
		sql=sql&" and n.top1=1"'头条
	elseif(bytype=2) then
		sql=sql&" and n.totop=1"'置顶
	elseif(bytype=3) then
		sql=sql&" and n.tohot=1"'热点
	elseif(bytype=4) then
		sql=sql&" and n.imgnews=true"'图文
	elseif(bytype=5) then
		sql=sql&" and n.recommend=true"'推荐
	end if
end if
sql=sql&" order by c.count desc,c.id desc"
set rs=server.CreateObject("adodb.recordset") 
rs.open sql,conn,3,1
while not rs.eof
	response.Write("document.write('<li>·<a href="""&SiteUrl&"/"&rs(2)&""" target=""_blank"">"&left(replace(rs(1),",","\'"),max)&"</a> ["&rs(3)&"]</li>');"&Chr(10))
	rs.movenext
wend

rs.close
set rs=nothing
call connclose
%>
