📄 syscode.asp
字号:
currentPage=1
call ArticleContent(TitleLen,True,True,True,2,True,True)
end if
end if
end if
rsArticle.close
set rsArticle=nothing
end sub
'=================================================
'过程名:ArticleContent
'作 用:显示文章属性、标题、作者、更新日期、点击数等信息
'参 数:intTitleLen ----标题最多字符数,一个汉字=两个英文字符
' ShowProperty ----是否显示文章属性(固顶/推荐/普通),True为显示,False为不显示
' ShowIncludePic ---是否显示“[图文]”字样,True为显示,False为不显示
' ShowAuthor -------是否显示文章作者,True为显示,False为不显示
' ShowDateType -----显示更新日期的样式,0为不显示,1为显示年月日,2为只显示月日。
' ShowHits ---------是否显示文章点击数,True为显示,False为不显示
' ShowHot ----------是否显示热门文章标志,True为显示,False为不显示
'=================================================
sub ArticleContent(intTitleLen,ShowProperty,ShowIncludePic,ShowAuthor,ShowDateType,ShowHits,ShowHot)
dim i,strTemp,TitleStr,Author,AuthorName,AuthorEmail
i=0
do while not rsArticle.eof
strTemp=""
if ShowProperty=True then
if rsArticle("OnTop")=true then
strTemp = strTemp & "<img src='images/article_ontop.gif' alt='固顶文章'> "
elseif rsArticle("Elite")=true then
strTemp = strTemp & "<img src='images/article_elite.gif' alt='推荐文章'> "
else
strTemp = strTemp & "<img src='images/article_common.gif' alt='普通文章'> "
end if
end if
if ShowIncludePic=True and rsArticle("IncludePic")=true then
strTemp = strTemp & "<font color=blue>[图文]</font>"
end if
Author=rsArticle("Author")
if instr(Author,"|")>0 then
AuthorName=left(Author,instr(Author,"|")-1)
AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1)
else
AuthorName=Author
AuthorEmail=""
end if
strTemp = strTemp & "<a href='" & rsArticle("LayoutFileName") & "?ArticleID=" & rsArticle("articleid") & "' title='文章标题:" & rsArticle("Title") & vbcrlf & "作 者:" & AuthorName & vbcrlf & "更新时间:" & rsArticle("UpdateTime") & vbcrlf & "点击次数:" & rsArticle("Hits") & "' target='_blank'>"
TitleStr=gotTopic(rsArticle("title"),intTitleLen)
if rsArticle("TitleFontType")=1 then
TitleStr="<b>" & TitleStr & "</b>"
elseif rsArticle("TitleFontType")=2 then
TitleStr="<em>" & TitleStr & "</em>"
elseif rsArticle("TitleFontType")=3 then
TitleStr="<b><em>" & TitleStr & "</em></b>"
end if
if rsArticle("TitleFontColor")<>"" then
TitleStr="<font color='" & rsArticle("TitleFontColor") & "'>" & TitleStr & "</font>"
end if
strTemp=strTemp & TitleStr & "</a>"
if ShowAuthor=True or ShowDateType>0 or ShowHits=True then
strTemp = strTemp & " ("
if ShowAuthor=True then
if AuthorEmail="" then
strTemp=strTemp & AuthorName
else
strTemp=strTemp & "<a href='mailto:" & AuthorEmail & "'>" & AuthorName & "</a>"
end if
end if
if ShowDateType>0 then
if ShowAuthor=True then
strTemp=strTemp & ","
end if
if CDate(FormatDateTime(rsArticle("UpdateTime"),2))=date() then
strTemp = strTemp & "<font color=red>"
else
strTemp= strTemp & "<font color=#999999>"
end if
if ShowDateType=1 then
strTemp= strTemp & month(rsArticle("UpdateTime")) & "月" & day(rsArticle("UpdateTime")) & "日</font>"
else
strTemp=strTemp & FormatDateTime(rsArticle("UpdateTime"),1) & "</font>"
end if
end if
if ShowHits=True then
if ShowAuthor=True or ShowDateType>0 then
strTemp=strTemp & ","
end if
strTemp=strTemp & rsArticle("Hits")
end if
strTemp=strTemp & ")"
end if
if ShowHot=True and rsArticle("Hits")>=HitsOfHot then
strTemp= strTemp & "<img src='images/hot.gif' alt='热点文章'>"
end if
strTemp= strTemp & "<br>"
response.write strTemp
rsArticle.movenext
i=i+1
if i>=MaxPerPage then exit do
loop
end sub
'=================================================
'过程名:ShowUserArticle
'作 用:分页显示用户文章标题等信息
'参 数:TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowUserArticle(TitleLen)
if TitleLen<0 or TitleLen>200 then
TitleLen=50
end if
sqlArticle=sqlArticle & "select A.ArticleID,A.ClassID,L.LayoutID,L.LayoutFileName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,"
sqlArticle=sqlArticle & "A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Article A"
sqlArticle=sqlArticle & " inner join Layout L on A.LayoutID=L.LayoutID where A.Deleted=False and A.Passed=True and Editor='" & UserName & "'"
if SpecialID>0 then
sqlArticle=sqlArticle & " and A.SpecialID=" & SpecialID
end if
if ClassId>0 then
sqlArticle=sqlArticle & " and A.ClassID=" & ClassID
end if
sqlArticle=sqlArticle & " order by A.OnTop,A.ArticleID desc"
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sqlArticle,conn,1,1
if rsArticle.bof and rsArticle.eof then
totalput=0
response.Write("<br><li>没有任何文章</li>")
else
totalput=rsArticle.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
call ArticleContent(TitleLen,True,True,True,2,True,True)
else
if (currentPage-1)*MaxPerPage<totalPut then
rsArticle.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsArticle.bookmark
call ArticleContent(TitleLen,True,True,True,2,True,True)
else
currentPage=1
call ArticleContent(TitleLen,True,True,True,2,True,True)
end if
end if
end if
rsArticle.close
set rsArticle=nothing
end sub
'=================================================
'过程名:ShowSearchResult
'作 用:分页显示搜索结果
'参 数:无
'=================================================
sub ShowSearchResult()
dim arrClassID,trs
sqlSearch=sqlSearch & "select A.ArticleID,A.ClassID,L.LayoutID,L.LayoutFileName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,A.Content,"
sqlSearch=sqlSearch & "A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Article A"
sqlSearch=sqlSearch & " inner join Layout L on A.LayoutID=L.LayoutID where A.Deleted=False and A.Passed=True"
if ClassID>0 then
if Child>0 then
arrClassID=ClassID
set trs=conn.execute("select ClassID from ArticleClass where ParentID=" & ClassID & " or ParentPath like '%" & ParentPath & "," & ClassID & ",%' and Child=0 and LinkUrl='' and BrowsePurview>=" & UserLevel)
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sqlSearch=sqlSearch & " and A.ClassID in (" & arrClassID & ")"
else
sqlSearch=sqlSearch & " and A.ClassID=" & ClassID
end if
end if
if keyword<>"" then
select case strField
case "Title"
sqlSearch=sqlSearch & " and A.Title like '%" & keyword & "%' "
case "Content"
sqlSearch=sqlSearch & " and A.Content like '%" & keyword & "%' "
case "Author"
sqlSearch=sqlSearch & " and A.Author like '%" & keyword & "%' "
case "Editor"
sqlSearch=sqlSearch & " and A.Editor like '%" & keyword & "%' "
case else
sqlSearch=sqlSearch & " and A.Title like '%" & keyword & "%' "
end select
end if
sqlSearch=sqlSearch & " order by A.Articleid desc"
Set rsSearch= Server.CreateObject("ADODB.Recordset")
rsSearch.open sqlSearch,conn,1,1
if rsSearch.eof and rsSearch.bof then
totalput=0
response.write "<p align='center'><br><br>没有或没有找到任何文章</p>"
else
totalput=rsSearch.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
call SearchResultContent()
else
if (currentPage-1)*MaxPerPage<totalPut then
rsSearch.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsSearch.bookmark
call SearchResultContent()
else
currentPage=1
call SearchResultContent()
end if
end if
end if
rsSearch.close
set rsSearch=nothing
end sub
sub SearchResultContent()
dim i,strTemp,content
i=1
do while not rsSearch.eof
strTemp=""
strTemp=strTemp & cstr(MaxPerPage*(CurrentPage-1)+i) & ".<a href='" & rsSearch("LayoutFileName") & "?ArticleID=" & rsSearch("articleid") & "'>"
if strField="Title" then
strTemp=strTemp & "<b>" & replace(rsSearch("title"),""&keyword&"","<font color=red>"&keyword&"</font>") & "</b></font></a>"
else
strTemp=strTemp & "<b>" & rsSearch("title") & "</b>"
end if
if strField="Author" then
strTemp=strTemp & " [" & replace(rsSearch("Author"),""&keyword&"","<font color=red>"&keyword&"</font>") & "]"
else
strTemp=strTemp & " [" & rsSearch("Author") & "]"
end if
strTemp=strTemp & "[" & FormatDateTime(rsSearch("UpdateTime"),1) & "][" & rsSearch("Hits") & "]"
content=left(nohtml(rsSearch("content")),200)
if strField="Content" then
strTemp=strTemp & "<div style='padding:10px 20px'>" & replace(content,""&keyword&"","<font color=red>"&keyword&"</font>") & "……</div>"
else
strTemp=strTemp & "<div style='padding:10px 20px'>" & content & "……</div>"
end if
strTemp=strTemp & "</a>"
response.write strTemp
i=i+1
if i>MaxPerPage then exit do
rsSearch.movenext
loop
end sub
'=================================================
'过程名:ShowAnnounce
'作 用:显示本站公告信息
'参 数:ShowType ------显示方式,1为纵向,2为横向
' AnnounceNum ----最多显示多少条公告
'=================================================
sub ShowAnnounce(ShowType,AnnounceNum)
dim sqlAnnounce,rsAnnounce,i
if AnnounceNum>0 and AnnounceNum<=10 then
sqlAnnounce="select top " & AnnounceNum
else
sqlAnnounce="select top 10"
end if
sqlAnnounce=sqlAnnounce & " * from Announce where IsSelected=True order by ID Desc"
Set rsAnnounce= Server.CreateObject("ADODB.Recordset")
rsAnnounce.open sqlAnnounce,conn,1,1
if rsAnnounce.bof and rsAnnounce.eof then
AnnounceCount=0
response.write "<p> 没有通告</p>"
else
AnnounceCount=rsAnnounce.recordcount
if ShowType=1 then
do while not rsAnnounce.eof
response.Write "<a href='Announce.asp?ID=" & rsAnnounce("id") &"' title='" & rsAnnounce("Content") & "' target=_Blank> " & rsAnnounce("title") & "</div><div align='right'>" & rsAnnounce("Author") & " <br>" & FormatDateTime(rsAnnounce("DateAndTime"),1) & "</a> "
rsAnnounce.movenext
loop
else
do while not rsAnnounce.eof
response.Write "<p><a href='Announce.asp?ID=" & rsAnnounce("id") &"' title='" & rsAnnounce("Content") & "' target=_Blank> " & rsAnnounce("title") & " [" & rsAnnounce("Author") & " " & FormatDateTime(rsAnnounce("DateAndTime"),1) & "]</a></p>"
rsAnnounce.movenext
i=i+1
if i<AnnounceCount then response.write "<hr>"
loop
end if
end if
rsAnnounce.close
set rsAnnounce=nothing
end sub
'=================================================
'过程名:ShowHot
'作 用:显示热门文章
'参 数:ArticleNum ----最多显示多少篇文章
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowHot(ArticleNum,TitleLen)
dim sqlHot,rsHot
if ArticleNum>0 and ArticleNum<=100 then
sqlHot="select top " & ArticleNum
else
sqlHot="select top 10 "
end if
sqlHot=sqlHot & " A.ArticleID,A.Title,A.Author,A.UpdateTime,A.Hits,L.LayoutFileName from article A inner join Layout L on L.LayoutID=A.LayoutID where A.Deleted=False and A.Passed=True And A.Hits>=" & HitsOfHot & " order by A.Hits desc,A.ArticleID desc"
Set rsHot= Server.CreateObject("ADODB.Recordset")
rsHot.open sqlHot,conn,1,1
if TitleLen<0 or TitleLen>255 then TitleLen=50
if rsHot.bof and rsHot.eof then
response.write "<li>无热门文章</li>"
else
do while not rsHot.eof
response.Write "<a href='" & rsHot("LayoutFileName") & "?ArticleID=" & rsHot("articleid") &"' title='文章标题:" & rsHot("Title") & vbcrlf & "作 者:" & rsHot("Author") & vbcrlf & "更新时间:" & rsHot("UpdateTime") & vbcrlf & "点击次数:" & rsHot("Hits") & "' target='_blank'>" & gotTopic(rsHot("title"),TitleLen) & "</a>[<font color=#000000>" & rsHot("hits") & "</font>]<br>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -