📄 powereasy.article.asp
字号:
strFileName = strFileName & "&Content=" & Content
sqlSearch = sqlSearch & " and Content like '%" & Content & "%'"
End If
If Intro <> "" Then
Intro = ReplaceBadChar(Intro)
strFileName = strFileName & "&Intro=" & Intro
sqlSearch = sqlSearch & " and Intro like '%" & Intro & "%'"
End If
If Author <> "" Then
Author = ReplaceBadChar(Author)
strFileName = strFileName & "&Author=" & Author
sqlSearch = sqlSearch & " and Author like '%" & Author & "%' "
End If
If CopyFrom <> "" Then
CopyFrom = ReplaceBadChar(CopyFrom)
strFileName = strFileName & "&CopyFrom=" & CopyFrom
sqlSearch = sqlSearch & " and CopyFrom like '%" & CopyFrom & "%' "
End If
If Inputer <> "" Then
Inputer = ReplaceBadChar(Inputer)
strFileName = strFileName & "&Inputer=" & Inputer
sqlSearch = sqlSearch & " and Inputer='" & Inputer & "' "
End If
If Keyword2 <> "" Then
Keyword2 = ReplaceBadChar(Keyword2)
strFileName = strFileName & "&Keywords=" & Keyword2
sqlSearch = sqlSearch & " and Keyword like '%" & Keyword2 & "%' "
End If
If LowInfoPoint > 0 Then
strFileName = strFileName & "&LowInfoPoint=" & LowInfoPoint
sqlSearch = sqlSearch & " and InfoPoint >=" & LowInfoPoint
End If
If HighInfoPoint > 0 Then
strFileName = strFileName & "&HighInfoPoint=" & HighInfoPoint
sqlSearch = sqlSearch & " and InfoPoint <=" & HighInfoPoint
End If
If IsDate(BeginDate) Then
strFileName = strFileName & "&BeginDate=" & BeginDate
If SystemDatabaseType = "SQL" Then
sqlSearch = sqlSearch & " and UpdateTime >= '" & BeginDate & "'"
Else
sqlSearch = sqlSearch & " and UpdateTime >= #" & BeginDate & "#"
End If
End If
If IsDate(EndDate) Then
strFileName = strFileName & "&EndDate=" & EndDate
If SystemDatabaseType = "SQL" Then
sqlSearch = sqlSearch & " and UpdateTime <= '" & EndDate & "'"
Else
sqlSearch = sqlSearch & " and UpdateTime <= #" & EndDate & "#"
End If
End If
Set rsField = Conn.Execute("select * from PE_Field where ChannelID=-1 or ChannelID=" & ChannelID & "")
Do While Not rsField.EOF
If Trim(Request(rsField("FieldName"))) <> "" Then
strFileName = strFileName & "&" & Trim(rsField("FieldName")) & "=" & ReplaceBadChar(Trim(Request(rsField("FieldName"))))
sqlSearch = sqlSearch & " and " & Trim(rsField("FieldName")) & " like '%" & ReplaceBadChar(Trim(Request(rsField("FieldName")))) & "%' "
End If
rsField.MoveNext
Loop
Set rsField = Nothing
End If
sqlSearch = sqlSearch & " order by ArticleID desc"
arrArticleID = ""
Set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.Open sqlSearch, Conn, 1, 1
If rsSearch.BOF And rsSearch.EOF Then
totalPut = 0
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
If (CurrentPage - 1) * MaxPerPage < totalPut Then
rsSearch.Move (CurrentPage - 1) * MaxPerPage
Else
CurrentPage = 1
End If
End If
ArticleNum = 0
Do While Not rsSearch.EOF
If arrArticleID = "" Then
arrArticleID = rsSearch(0)
Else
arrArticleID = arrArticleID & "," & rsSearch(0)
End If
ArticleNum = ArticleNum + 1
If ArticleNum >= MaxPerPage Then Exit Do
rsSearch.MoveNext
Loop
End If
rsSearch.Close
Set rsSearch = Nothing
GetSearchResultIDArr = arrArticleID
End Function
'=================================================
'函数名:GetSearchResult
'作 用:分页显示搜索结果
'参 数:无
'=================================================
Private Function GetSearchResult(iChannelID)
Dim sqlSearch, Intro, rsSearch, iCount, ArticleNum, arrArticleID, strSearchResult, Content
strSearchResult = ""
arrArticleID = GetSearchResultIDArr(iChannelID)
If arrArticleID = "" Then
GetSearchResult = "<p align='center'><br><br>" & R_XmlText_Class("ShowSearch/NoFound", "没有或没有找到任何{$ChannelShortName}") & "<br><br></p>"
Exit Function
End If
ArticleNum = 1
sqlSearch = "select A.ChannelID,A.ArticleID,A.Title,A.Author,A.UpdateTime,A.Hits,A.Intro,A.InfoPurview,A.InfoPoint,A.Content,C.ClassID,C.ClassName,C.ParentDir,C.ClassDir,C.ClassPurview from PE_Article A left join PE_Class C on A.ClassID=C.ClassID where ArticleID in (" & arrArticleID & ") order by ArticleID desc"
Set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.Open sqlSearch, Conn, 1, 1
Do While Not rsSearch.EOF
If iChannelID = 0 Then
If rsSearch("ChannelID") <> PrevChannelID Then
Call GetChannel(rsSearch("ChannelID"))
PrevChannelID = rsSearch("ChannelID")
End If
End If
strSearchResult = strSearchResult & "<b>" & CStr(MaxPerPage * (CurrentPage - 1) + ArticleNum) & ".</b> "
strSearchResult = strSearchResult & "[<a class='LinkSearchResult' href='" & GetClassUrl(rsSearch("ParentDir"), rsSearch("ClassDir"), rsSearch("ClassID"), rsSearch("ClassPurview")) & "' target='_blank'>" & rsSearch("ClassName") & "</a>] "
strSearchResult = strSearchResult & "<a class='LinkSearchResult' href='" & GetArticleUrl(rsSearch("ParentDir"), rsSearch("ClassDir"), rsSearch("UpdateTime"), rsSearch("ArticleID"), rsSearch("ClassPurview"), rsSearch("InfoPurview"), rsSearch("InfoPoint")) & "' target='_blank'>"
If strField = "Title" Then
strSearchResult = strSearchResult & "<b>" & Replace(ReplaceText(rsSearch("Title"), 2) & "", "" & Keyword & "", "<font color=red>" & Keyword & "</font>") & "</b>"
Else
strSearchResult = strSearchResult & "<b>" & ReplaceText(rsSearch("Title"), 2) & "</b>"
End If
strSearchResult = strSearchResult & "</a>"
If strField = "Author" Then
strSearchResult = strSearchResult & " [" & Replace(rsSearch("Author") & "", "" & Keyword & "", "<font color=red>" & Keyword & "</font>") & "]"
Else
strSearchResult = strSearchResult & " [" & rsSearch("Author") & "]"
End If
strSearchResult = strSearchResult & "[" & FormatDateTime(rsSearch("UpdateTime"), 1) & "][" & rsSearch("Hits") & "]"
strSearchResult = strSearchResult & "<br>"
If rsSearch("Intro") <> "" Then
Intro = "简介:" & Replace(Replace(ReplaceText(nohtml(rsSearch("Intro")), 1), ">", ">"), "<", "<") & "<br>"
Else
Intro = "简介:无<br>"
End If
If rsSearch("ClassPurview") > 0 Or rsSearch("InfoPoint") > 0 Then
strSearchResult = strSearchResult & "<div style='padding:10px 20px'>" & SearchResult_Content_NoPurview & "</div>"
Else
Content = Intro & "内容:<br>" & Left(Replace(Replace(ReplaceText(nohtml(rsSearch("content")), 1), ">", ">"), "<", "<"), SearchResult_ContentLenth)
If strField = "Content" Then
strSearchResult = strSearchResult & "<div style='padding:10px 20px'>" & Replace(Content, "" & Keyword & "", "<font color=red>" & Keyword & "</font>") & "……</div>"
Else
strSearchResult = strSearchResult & "<div style='padding:10px 20px'>" & Content & "……</div>"
End If
End If
strSearchResult = strSearchResult & "<br>"
ArticleNum = ArticleNum + 1
rsSearch.MoveNext
Loop
rsSearch.Close
Set rsSearch = Nothing
GetSearchResult = strSearchResult
End Function
Public Function GetSearchResult2(iChannelID, strValue) '得到自定义列表的版面设计的HTML代码
Dim strCustom, strParameter
strCustom = strValue
regEx.Pattern = "【SearchResultList\((.*?)\)】([\s\S]*?)【\/SearchResultList】"
Set Matches = regEx.Execute(strCustom)
For Each Match In Matches
strParameter = Replace(Match.SubMatches(0), Chr(34), " ")
strCustom = PE_Replace(strCustom, Match.Value, GetSearchResultLabel(strParameter, Match.SubMatches(1), iChannelID))
Next
GetSearchResult2 = strCustom
End Function
'搜索自定义标签
Private Function GetSearchResultLabel(strTemp, strList, iChannelID)
Dim sqlSearch, rsSearch, rsCustom, iCount, arrArticleID
Dim arrTemp, strCustomList
Dim strArticlePic, strPicTemp, arrPicTemp, UsePage
Dim IncludeChild, iSpecialID, IsHot, IsElite, DateNum, OrderType, TitleLen, ContentLen
Dim iCols, iColsHtml, iRows, iRowsHtml, iNumber
Dim rsField, ArrField, iField
If strTemp = "" Or strList = "" Then GetSearchResultLabel = "": Exit Function
iCols = 1: iRows = 1: iColsHtml = "": iRowsHtml = ""
regEx.Pattern = "【(Cols|Rows)=(\d{1,2})\s*(?:\|||)(.+?)】"
Set Matches = regEx.Execute(strList)
For Each Match In Matches
If LCase(Match.SubMatches(0)) = "cols" Then
If Match.SubMatches(1) > 1 Then iCols = Match.SubMatches(1)
iColsHtml = Match.SubMatches(2)
ElseIf LCase(Match.SubMatches(0)) = "rows" Then
If Match.SubMatches(1) > 1 Then iRows = Match.SubMatches(1)
iRowsHtml = Match.SubMatches(2)
End If
strList = regEx.Replace(strList, "")
Next
arrTemp = Split(strTemp, ",")
If UBound(arrTemp) <> 2 Then
GetSearchResultLabel = "自定义列表标签:【SearchResultList(参数列表)】列表内容【/SearchResultList】的参数个数不对。请检查模板中的此标签。"
Exit Function
End If
TitleLen = arrTemp(0)
UsePage = arrTemp(1)
ContentLen = arrTemp(2)
arrArticleID = GetSearchResultIDArr(iChannelID)
If arrArticleID = "" Then
GetSearchResultLabel = "<p align='center'><br><br>" & R_XmlText_Class("ShowSearch/NoFound", "没有或没有找到任何{$ChannelShortName}") & "<br><br></p>"
Exit Function
End If
Set rsField = Conn.Execute("select FieldName,LabelName from PE_Field where ChannelID=-1 or ChannelID=" & ChannelID & "")
If Not (rsField.BOF And rsField.EOF) Then
ArrField = rsField.getrows(-1)
End If
Set rsField = Nothing
sqlSearch = "select A.ChannelID,A.ArticleID,A.Title,A.Subheading,"
If IsArray(ArrField) Then
For iField = 0 To UBound(ArrField, 2)
sqlSearch = sqlSearch & "A." & ArrField(0, iField) & ","
Next
End If
iCount = 0
strCustomList = ""
sqlSearch = sqlSearch & "A.Author,A.Keyword,A.CopyFrom,A.DefaultPicUrl,A.InfoPoint,A.Editor,A.OnTop,A.UpdateTime,A.Hits,A.Elite,A.Intro,A.Inputer,A.InfoPurview,A.Content,A.Stars,C.ClassID,C.ClassName,C.ParentDir,C.ClassDir,C.ClassPurview,C.ReadMe from PE_Article A left join PE_Class C on A.ClassID=C.ClassID where ArticleID in (" &
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -