<!--#include file="inc/conn.asp"-->
<%
'*********************************************************************************************
'文件名: newstopic.asp 首页新闻调用
'可以重复调用,调用方式<script src=newstopic.asp?info=1&tlen=13&newstype=1&n=8&orders=1></script>
'其中info为显示日期 1显示0不显示
'tlen为显示标题长度
'newstype为新闻类型 1新闻中心 2广告中心 3展交中心
'n为显示多少记录,如果为空,则取默认值10
'orders为排序方式 1为按点击率排序 0为按日期排序
'powered by 清风
'MSN: anwellsz@msn.com
'QQ: 110125707
'Last Update: 11/15/2004
'**********************************************************************************************
Rem 过滤HTML代码
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode = fString
end if
end function
dim rs,topic,rss,newstype,newsurl,n,orders
newstype = Request("newstype")
n = Request("n")
if isnumeric(n)=0 or n="" then n=10
if request("orders")=1 then
orders="hits"
else
orders="tDate"
end if
select case newstype
case 1
newstype = "新闻中心"
newsurl = "two-1.asp" '新闻链接地址,请根据相应页面做适当修改
case 2
newstype = "广告中心"
newsurl = "three-1.asp"
case 3
newstype = "展交中心"
newsurl = "four-a1.asp"
case else
end select
set rss=conn.execute("select id,classname from [classname] where classname='"&newstype&"'")
do while not rss.eof
newstypeid = rss(0)
rss.movenext
loop
set rs=conn.execute("select top "&n&" id,Title,classid,tDate,hits from news where classid = "&newstypeid&" ORDER BY "&orders&" desc")
do while Not RS.Eof
topic = rs(1)
if len(topic)>Cint(request("tlen")) then
topic=left(topic,request("tlen"))&"..."
end if
topic=HTMLEncode(topic)
response.write "document.write('<tr><td width=5% height=22><p align=left><img src=images/14.gif></td><td height=22 width=68% ><span style=""font-size:9pt;line-height: 15pt""><a href="&newsurl&"?newsid="&rs(0)&" target=_blank><font color=#000000>');"
response.write "document.write('"&topic&"');"
response.write "document.write('</font></a></td>');"
select case request("info")
case 1
response.write "document.write('<td><font color=#808080>"&year(rs(3))&"-"&month(rs(3))&"-"&day(rs(3))&"</font></td></tr>');"
case else
response.write "document.write('<Td> </td></tr>');"
end select
response.write "document.write('</span>');"
RS.MoveNext
Loop
rs.close
set rs=nothing
conn.close
set conn=nothing
%>