<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/dsql.asp"-->
<%
dim catalogid,charMax,topSql,topN,lineH,orderby,isshowhits
'栏目ID
if not isempty(request.QueryString("catalogid")) then
	catalogid=Clng(trim(request.QueryString("catalogid")))
else
	catalogid=0
end if
'限制字符个数
if(request.QueryString("max")<>"") then
	charMax=Cint(request.QueryString("max"))
else
	charMax=10
end if
'调用个数
if(request.QueryString("num")<>"") then
	topN=Cint(request.QueryString("num"))
else
	topN=10
end if
'行高
if(request.QueryString("lineh")<>"") then
	lineH=Cint(request.QueryString("lineh"))
else
	lineH=26
end if
'排序
if(request.QueryString("orderby")<>"") then
	orderby=Cint(request.QueryString("orderby"))
else
	orderby=0
end if
'是否显示点击数
if(request.querystring("showhits")<>"") then
	isshowhits=Cint(request.querystring("showhits"))
else
	isshowhits=1'默认显示
end if
topSql="Select top "&topN&" title,linkurl,hits from news"
if(catalogid>0) then
	topSql=topSql&" where classid="&catalogid
end if
if(orderby=0) then
	topSql=topSql&" order by id desc"
elseif(orderby=1) then
	topSql=topSql&" order by hits desc,id desc"
elseif(orderby=2) then
	topSql=topSql&" order by moditime desc"
end if

response.Write("document.write('<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">');"&Chr(13))
Set rs = Server.CreateObject("Adodb.RecordSet")				 
rs.Open topSql,conn,3,1
while not rs.eof
	response.Write("document.write('<tr><td height="""&lineH&"""><div aligh=""left""><div align=""left"">');"&Chr(13))
	response.Write("document.write('<img src="""&SiteUrl&"/images/a_mp.gif"&""">');"&Chr(13))
	response.Write("document.write('<a href="""&SiteUrl&"/"&rs(1)&""">"&replace(left(rs(0),charMax),"'","\'")&"</a>');"&Chr(13))
	if(isshowhits<>0) then
		response.Write("document.write('<span style=""font-size: 10px;"">["&rs(2)&"]</span>');"&Chr(13))
	end if
	response.Write("document.write('</div></div></td></tr>');"&Chr(13))
	rs.movenext
wend
response.Write("document.write('</table>');"&Chr(13))
rs.close
set rs=nothing
call connclose()
%>