<!--#include file="conn.asp" -->
<%
'ft_na贴子调用函数
'调用方法<script src="callfun.asp?n=10&a=0&b=0&c=0&d=0"></script\>
'n为记录数
'a类别显示标识值为0时不显示论坛类别1显示论坛类别
'b日期显示标识值为0时不显示1显示
'c作者显示标识值为0时不显示1显示
'd为贴子标识0为最新贴1为精华贴2为推荐贴

n=request("n")
a=request("a")
b=request("b")
c=request("c")
d=request("d")
ft_na n,a,b,c,d
Function ft_na(n,a,b,c,d)
if d=1 then
sql="SELECT top "&n&" * FROM BBS_Cate,bbstitle where BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 and bbstitle.deleted=0 and bbstitle.huati=1 order by redate desc"
elseif d=2 then
sql="SELECT top "&n&" * FROM BBS_Cate,bbstitle where BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 and bbstitle.deleted=0 and bbstitle.sign=1 order by redate desc"
else
sql="SELECT top "&n&" * FROM BBS_Cate,bbstitle where BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 and bbstitle.deleted=0 and BBS_Cate.BBS_Cate_Qs=0 order by redate desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
  nl=""
  do while not rs.eof
  id=rs("id")
  title=rs("title")
  boardid_1=rs("boardid_1")
  boardid_2=rs("boardid_2")
  BBS_Cate_Name=rs("BBS_Cate_Name")
  htmfilename=rs("htmfilename")
  tk1="default.asp?a="&boardid_1&"&b="&boardid_2
  if a=1 then
  astring="[<a href="&tk1&">"&rs("BBS_Cate_Name")&"</a>]"
  end if
  if b=1 then
  bstring=formatdatetime(rs("redate"),2)
  end if
  if c=1 then
  cstring=rs("user_id")
  end if
  nl=nl&astring&"<a href="&rs("htmfilename")&" target=""_blank"">"&rs("title")&"</a>&nbsp;"&cstring& " "&bstring&"<br>"& vbCrLf
  rs.movenext
  loop
else
  nl="记录为空"
end if
Response.Write "document.write('"&nl&"');"
rs.close
set rs=nothing
End Function
'图片调用函数
Function ft_pic(n,a,b,c,d)
sql="select top "&n&" * from bbstitle,ftbbs_upload where bbstitle.htmfilename=ftbbs_upload.upload_htm and bbstitle.deleted=0 and ftbbs_upload.sign=0 and ftbbs_upload.bbs_blog_type=0 and (ftbbs_upload.upload_ext='jpg' or ftbbs_upload.upload_ext='gif') order by bbstitle.id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
  nl=""
  do while not rs.eof
  id=rs("id")
  title=rs("title")
  boardid_1=rs("boardid_1")
  boardid_2=rs("boardid_2")
  BBS_Cate_Name=rs("BBS_Cate_Name")
  htmfilename=rs("htmfilename")
  tk1="default.asp?a="&boardid_1&"&b="&boardid_2
  if a=1 then
  astring="[<a href="&tk1&">"&rs("BBS_Cate_Name")&"</a>]"
  end if
  if b=1 then
  bstring=formatdatetime(rs("redate"),2)
  end if
  if c=1 then
  cstring=rs("user_id")
  end if
  nl=nl&astring&"<a href="&rs("htmfilename")&" target=""_blank"">"&rs("title")&"</a>&nbsp;"&cstring& " "&bstring&"<br>"& vbCrLf
  rs.movenext
  loop
else
  nl="记录为空"
end if
Response.Write "document.write('"&nl&"');"
rs.close
set rs=nothing
End Function
%>