<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/function.jsp" -->
<%
'参数介绍
'num                 文章条数
'size                每行显示文字数
'ShowBigCategory =1  表示显示大类别
'target              窗口
'time                显示时间
'date                显时日期
'hits                显示点击
'cate                显示类别

'javascript Html
if Request("ShowBigCategory") <> 1 then
  '显示小类
  mSql = "F_SmallCategoryID,F_ID,F_FilePath,F_Title,F_IsPic,F_Addtime,F_hits,F_Content,F_Keywords,F_BigCategoryID From T_Article"
else
  '显示大类
  m_Sql = "Select F_BigCategoryID From T_SmallCategory"
  Set rs = conn.Execute(m_Sql)
  mSql = "F_SmallCategoryID,F_ID,F_FilePath,F_Title,F_IsPic,F_Addtime,F_hits,F_Content,F_Keywords,F_BigCategoryID From T_Article"
  rs.Close
end if

num = Request.QueryString("num")
if num<>"" then
  if isnumeric(num) then
    mSql="Select Top "&num&" "+mSql
  else
    mSql = "Select Top 10 "+mSql
  end if
else
    mSql = "Select Top 10 "+mSql
end if

'相关新闻
mKeywords = Request("keywords")
If mKeywords="" then
  mSql= mSql +" and (1=1)"
Else
  mArray = split(mKeywords,",")
  mSql=mSql+" and (F_Title like"+"'%"+mArray(0)+"%' or F_Content like"+"'%"+mArray(0)+"%'"
  for i = 1 to UBound(mArray)
    mSql=mSql+"or F_Title like"+"'%"+mArray(i)+"%' or F_Content like"+"'%"+mArray(i)+"%'"
  next
  mSql=mSql+")"
End if

if Request("order")="" then
  mSql = mSql&" order by F_ID desc"
else
  if Request("order")="time" then
    mSql = mSql&" order by F_Addtime desc,F_Hits desc"
  else
    mSql = mSql&" order by F_Hits desc,F_Addtime desc"
  end if
end if

nheight = Request("height")
nsize = Request("size")
ndate = request("date")
ntime = request("time")
nhits = request("hits")
ntarget = Request("target")
ncate = Request("cate")

mSql = replace(mSql,"T_Article and","T_Article where")
set rs = Server.CreateObject("Adodb.RecordSet")
rs.open mSql,conn,1,1
mTitle=rs("F_Title")
if not rs.eof then
  newslist=rs.getrows()
end if
rs.close

ServerPath="http://" & Request.ServerVariables("HTTP_HOST")+mid(request.ServerVariables("URL"),1,instr(2,Request.ServerVariables("URL"),"/"))&"../Htmls/"
response.write "var html='';"&vbcrlf

if isarray(newslist)  then
  for i=0 to ubound(newslist,2)

    Response.write "html+='"
    if id="" then
      category=newslist(0,i)'类别
  	  mSql="Select F_Value From T_SmallCategory Where F_ID=" & category
	  Set rst = conn.Execute(mSql)
	  
	  if not rst.eof then category=rst(0)

      catedir=newslist(2,i)'FilePath
      if ncate=1 then
		if ntarget="" then
		   response.write "<a title="&category&" href=""" & ServerPath & "SmallCategory.jsp?BigCategoryID="&newslist(8,i)&"&SmallCategoryID="&newslist(0,i)&""""" style=""color:FF6600"">["&category&"]</a> "
         else
		   response.write "<a title="&category&" target="&ntarget&" href=""" & ServerPath & "SmallCategory.jsp?BigCategoryID="&newslist(8,i)&"&SmallCategoryID="&newslist(0,i)&""""" style=""color:FF6600"">["&category&"]</a> "
	    end if	 
	  else
        response.write ""
      end if
	  
    else
      response.write ""
    end if
		if mTitle <> newslist(3,i) then
    'response.write "·<a href=""" & serverpath & replace(newslist(2,i),"\","/") & newslist(1,i)&".htm"" style=""color:000000;"
    if ntarget = "" then
	  response.write "·<a  href=""" & ServerPath & catedir&" "" style="""
    else
      response.write "·<a class=OtherLink target="&ntarget&" href=""" & ServerPath & catedir&" "" style="""
    end if
    if nheight<>"" then
      if isnumeric(nheight) then
        response.write "line-height:"&nheight&"pt"
      end if
    end if

    response.write """ title="""&newslist(3,i)&""">"
    if nsize<>"" then
      if isnumeric(nsize) then
        if newslist(4,i)=1 then
          newslist(3,i)=GetWord(newslist(3,i),CCur(nsize)-4,"")
        else
          newslist(3,i)=GetWord(newslist(3,i),CCur(nsize),"......")
        end if
      end if
    end if
    response.write replace(newslist(3,i),"'","\'")&"</a>"
    if nhits=1 then
      response.write "<font color=aaaaaa>(<font color=red>"&newslist(6,i)&"</font>)</font>"
    end if


    if newslist(4,i)=1 then
      response.write "[<font color=D669A5>图</font>]"
    end if

    if ndate=1 and ntime=1 then
      response.write "<font color=aaaaaa>("&newslist(5,i)&")</font>"
    else
      newslist(5,i)=split(newslist(5,i)," ")
      if ndate=1 then
        response.write "<font color=aaaaaa>("&newslist(5,i)(0)&")</font>"
      end if
      if ntime=1 then
        response.write "<font color=aaaaaa>("&newslist(5,i)(1)&")</font>"
      end if
    end if
	end if
    response.write "<br>';"&vbcrlf
  next
else
  response.write "html+='该页暂无内容！';"
end if

response.write "document.write(html);"
response.end
%>
