加龙

加龙加香不加价
随笔 - 133, 评论 - 336 , 引用 - 51

leadbbs 帖子调用方法

leadbbs 帖子调用方法

''----- 调用举例: <script language=javascript src=http://安装目录/other/Article/topic.asp?BoardID=1&Number=20&StrLen=12&NewWindow=yes&PithFlag=0&ShowName=yes&ShowTime=yes&Pai=LastTime&ShowBoardName=yes></script>

''-----表示显示版面ID号为1的版面的最新20条主题,主题字数超过12个字节的以12字节显示(一个汉字为两个字节)
''----- 参数:BoardID 版面ID号,如果不指定,则表示调用论坛最新10条主题
''----- Number:显示记录条数,最多允许调用100条,不指定默认调用10条主题
''----- StrLen:有的帖子主题可能太长,为了美化显示效果,限制显示主题的字节长度
''----- NewWindow:在新窗口中打开请设置为yes,其它表示否
''----- PithFlag:是否调用精华,1-表示仅调用精华帖(可以加上BoardID限制调用版面)
''----- ShowName:是否显示发贴作者名字,yes显示,其它不显示
''----- ShowTime:是否显示新贴发表时间,yes显示,其它不显示
''----- Pai:新贴排序,ID(主题发贴时间)、LastTime(最后更新时间)、Hits(点击数)、ChildNum(回复数),不指定默认最后更新时间
''----- ShowBoardName:是否显示版块名称,yes显示,其它不显示
''----------------------------------------------------------------------------------------
''----- 调用某专题区最新主题
''----- <script language=javascript src=http://安装目录/other/Article/topic.asp?GoodAssort=10&Number=20&StrLen=12&NewWindow=yes></script>
''----- 参数:GoodAssort,指专题区编号
''-----------------------------------------------------------------------
''----- 调用最新投票
''----- <script language=javascript src=http://安装目录/other/Article/topic.asp?BoardID=1&Number=20&StrLen=12&NewWindow=yes&PithFlag=0&ShowName=yes&ShowTime=yes&Pai=LastTime&ShowBoardName=yes&Vote=yes></script>
''----- 参数vote=yes时调用所有最新投票
''----------------------------------------------------------------------------------------
dim lockurl,NotShowBoard
''lockurl="http://5256.web165.com,http://www.bootu.com";
NotShowBoard="8|13"
''----------------------------------------------------------------------------------------
''------锁定调用新贴网址和版块(2004-2-18)
''------lockurl 允许调用新贴网址,多个网址可以用分号隔开,不限制调用网址则留空
''------NotShowBoard 禁止调用的版块ID,禁止多个版块ID用 | 隔开,如果不禁止则留空
''----------------------------------------------------------------------------------------
if trim(lockurl)<>"" and checkserver(lockurl)=false then
response.write "document.write (''数据被保护,禁止被其他站点调用!'');"
response.end
end if

Private function checkserver(str)
dim i,servername
checkserver=false
if str="" then exit function
str=split(Cstr(str),",")
servername=Request.ServerVariables("HTTP_REFERER")
for i=0 to Ubound(str)
if right(str(i),1)="/" then str(i)=left(trim(str(i)),len(str(i))-1)
if Lcase(left(servername,len(str(i))))=Lcase(str(i)) then
checkserver=true
exit for
else
checkserver=false
end if
next
end function



Dim NSB,NSBnum,NSBstr,ii,Pai,vote
IF NotShowBoard<>"" then
NSB=split(NotShowBoard, "|")
NSBnum=ubound(NSB)

if Request.QueryString("PithFlag") = "1" then
NSBstr=" and "
else
NSBstr=" where "
end if

for ii=0 to NSBnum
NSBstr=NSBstr & "A.BoardID<>"& NSB(ii) &" and "
next
''不调用回收站新贴
NSBstr=NSBstr & "A.BoardID<>444"
END if


Vote=Request.QueryString("vote")
Pai=Request.QueryString("Pai")
if Pai="" then Pai="LastTime"

Dim HomeUrl
HomeUrl = "http://";;;;;;;&Request.ServerVariables("server_name")
If Request.ServerVariables("SERVER_PORT") <> "80" Then HomeUrl = HomeUrl & ":" & Request.ServerVariables("SERVER_PORT")
HomeUrl = Lcase(HomeUrl & Request.Servervariables("SCRIPT_NAME"))
HomeUrl = Replace(HomeUrl,"other/article/topic.asp","")

DEF_BBS_HomeUrl = "../../"
Const LMT_MaxDisplayAnnounce = 100
OpenDatabase
DisplayAnnounceList
closeDataBase

Function DisplayAnnounceList

Dim BoardID,ListNum,StrLen,GoodAssort
BoardID = Left(Request.QueryString("BoardID"),14)
ListNum = Left(Request.QueryString("Number"),14)
StrLen = Left(Request.QueryString("StrLen"),14)
GoodAssort = Left(Request.QueryString("GoodAssort"),14)
If isNumeric(StrLen) = False or StrLen = "" Then StrLen = 20
StrLen = Fix(cCur(StrLen))
If isNumeric(ListNum) = False or ListNum = "" Then ListNum = 10
If isNumeric(BoardID) = False Then BoardID = 0
BoardID = Fix(cCur(BoardID))
If isNumeric(GoodAssort) = False Then GoodAssort = 0
GoodAssort = Fix(cCur(GoodAssort))

ListNum = Fix(cCur(ListNum))
If ListNum < 1 or ListNum > 100 Then ListNum = 10
If StrLen < 1 or StrLen > 255 Then StrLen = 255
If GoodAssort < 1 Then GoodAssort = 0

Dim NewWindow,ShowName,ShowTime
NewWindow = Request.QueryString("NewWindow")
If NewWindow <> "yes" Then
NewWindow = ""
Else
NewWindow = " target=_blank"
End If
ShowName=Request.QueryString("ShowName")
ShowTime=Request.QueryString("ShowTime")

Dim Rs,SQL
Set rs = Server.CreateObject("ADODB.Recordset")

If GoodAssort > 0 Then
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID Where A.GoodAssort=" & GoodAssort & " Order by "& Pai &" DESC"
ELSEIf Vote="yes" Then
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID Where A.TopicType=80 Order by "& Pai &" DESC"
Else
If Request.QueryString("PithFlag") = "1" Then
If BoardID = 0 Then
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID Where A.GoodFlag=1 "& NSBstr &" Order by "& Pai &" DESC"
Else
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID Where A.GoodFlag=1 and A.BoardID=" & BoardID & " Order by "& Pai &" DESC"
End If
Else
If BoardID = 0 Then
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID" & NSBstr & " Order by "& Pai &" DESC"
Else
SQL = "select TOP " & ListNum & " A.ID,A.Title,A.TitleStyle,A.BoardID,A.UserName,A.LastTime,A.LastUser,B.BoardName from LeadBBS_Topic as A inner join LeadBBS_Boards as B on A.BoardID=B.BoardID Where A.BoardID=" & BoardID & " Order by "& Pai &" DESC"
End If
End If
End If

Set Rs = Con.ExeCute(SQL)
GBL_DBNum = GBL_DBNum + 1
Dim Num
Dim GetData
If Not rs.Eof Then
GetData = Rs.GetRows(-1)
Num = Ubound(GetData,2)
Else
Num = -1
End If
Rs.close
Set Rs = Nothing

Dim PostTime,NameTime,LastUser,BoardName

Response.Write "document.write("""
For SQL = 0 to Num
If GetData(2,SQL) = 1 Then GetData(1,SQL) = KillHTMLLabel(GetData(1,SQL))
If Len(GetData(1,SQL)) > StrLen/2 Then
If StrLength(GetData(1,SQL)) > StrLen Then
GetData(1,SQL) = LeftTrue(GetData(1,SQL),StrLen - 3) & "..."
End If
End If

IF Request.QueryString("ShowBoardName")="yes" then
BoardName="[<a href="& HomeUrl &"Board/Board.asp?BoardID=" & GetData(3,SQL) & NewWindow &">"&GetData(7,SQL)&"</a>] "
End if

NameTime=""
if ShowName="yes" then
LastUser=GetData(6,SQL)
if LastUser="" then LastUser=GetData(4,SQL)
NameTime="<td background='/bbs/images/topicbg.gif' height=16 width='15%'><a href=" & HomeUrl & "User/LookUserinfo.asp?name="&LastUser & NewWindow &">"&LastUser&"</a></td>"
end if

PostTime=GetData(5,SQL)
select case ShowTime
case"yes"
NameTime=NameTime & "<td background='/bbs/images/topicbg.gif' height=16 width=*> "&Left(PostTime,4)&"年"& mid(PostTime,5,2) &"月"&mid(PostTime,7,2)&"日 "& mid(PostTime,9,2)&":"&mid(PostTime,11,2)&"</td>"
case"yes2"
NameTime=NameTime & "<td background='/bbs/images/topicbg.gif' height=16 width=*> "&Left(PostTime,4)&"年"& mid(PostTime,5,2) &"月"&mid(PostTime,7,2)&"日</td>"
case"yes3"
NameTime=NameTime & "<td background='/bbs/images/topicbg.gif' height=16 width=*> "& mid(PostTime,9,2)&":"&mid(PostTime,11,2)&"</td>"
end select

Response.Write "<table border=0 width='100%' cellspacing=2><tr><td background='/bbs/images/topicbg.gif' height=16 width='55%'><font color=#FF3333>□</font> " & BoardName & "<a href=" & HomeUrl & "announce/announce.asp?BoardID=" & GetData(3,SQL) & "&id=" & GetData(0,SQL) & NewWindow & ">" & Replace(htmlencode(GetData(1,SQL)),"\","\\") & "</a></td>" & NameTime &"</tr></table>"
Next
Response.Write """);"

End Function%>
以上代码为调用代码 直接用DW打开,放入代码中保存为topic.asp 即可!




主题帖子调用使用说明


调用代码举例:
<script language=javascript src=http://安装目录/other/Article/topic.asp?BoardID=1&Number=20&StrLen=12&NewWindow=yes&PithFlag=0&showname=yes&showtime=yes&pai=LastTime></script>

以上代码表示显示版面ID号为1的版面的最新20条主题,主题字数超过12个字节的以12字节显示(一个汉字为两个字节),调用时显示贴子作者及最后更新时间,贴子列表按最后更新时间排序。

参数说明:
BoardID: 版面ID号,如果不指定,则表示调用论坛最新10条主题
Number:显示记录条数,最多允许调用100条,不指定默认调用10条主题
StrLen:有的帖子主题可能太长,为了美化显示效果,限制显示主题的字节长度
NewWindow:在新窗口中打开请设置为yes,其它表示否
PithFlag:是否调用精华,1-表示仅调用精华帖(可以加上BoardID限制调用版面)
showname:是否显示发贴作者名字,yes显示,其它不显示
showtime:是否显示新贴最后更新时间,yes显示“年月日+时间”,yes2显示“年月日”,yes3显示“时间”,其它不显示
pai:调用新贴排序,ID 、 LastTime或hits,ID是按发贴时间排序,LastTime是按最后更新排序,Hits是按贴子点击数排序,ChildNum是按主题回复数排序,不指定默认按最后更新时间排序
ShowBoardName:是否显示版块名称,yes显示,其它不显示
调用某专题区最新主题说明

调用代码举例:
<script language=javascript src=http://安装目录/other/Article/topic.asp?GoodAssort=10&Number=20&StrLen=12&NewWindow=yes&PithFlag=0&showname=yes&showtime=yes&pai=LastTime></script>



参数说明:

GoodAssort: 指专题区编号

 

锁定调用新贴网址和禁止调用方法

lockurl="http://5256.web165.com,http://www.bootu.com";;;;;;
NotShowBoard="100|888"

参数说明:
lockurl 允许调用新贴网址,多个网址可以用分号隔开,不限制调用网址则留空
NotShowBoard 禁止调用的版块ID,禁止多个版块ID用 | 隔开,如果不禁止则留空


发表于 2006年6月15日 13:32

评论

No comments posted yet.

Post Comment

主题  
姓名  
主页
校验码  
内容   
京ICP备 05050892号