📄 powereasy.photo.asp
字号:
If arrPhotoID = "" Then
GetSearchResult = "<p align='center'><br><br>" & R_XmlText_Class("ShowSearch/NoFound", "没有或没有找到任何{$ChannelShortName}") & "<br><br></p>"
Set rsSearch = Nothing
Exit Function
End If
PhotoNum = 1
sqlSearch = "select P.ChannelID,P.PhotoID,P.PhotoName,P.Author,P.UpdateTime,P.Hits,P.InfoPurview,P.InfoPoint,P.PhotoIntro,C.ClassID,C.ClassName,C.ParentDir,C.ClassDir,C.ClassPurview from PE_Photo P left join PE_Class C on P.ClassID=C.ClassID where PhotoID in (" & arrPhotoID & ") order by PhotoID 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) + PhotoNum) & ".</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='" & GetPhotoUrl(rsSearch("ParentDir"), rsSearch("ClassDir"), rsSearch("UpdateTime"), rsSearch("PhotoID"), rsSearch("ClassPurview"), rsSearch("InfoPurview"), rsSearch("InfoPoint")) & "' target='_blank'>"
If strField = "PhotoName" Then
strSearchResult = strSearchResult & "<b>" & Replace(ReplaceText(rsSearch("PhotoName"), 2) & "", "" & Keyword & "", "<font color=red>" & Keyword & "</font>") & "</b>"
Else
strSearchResult = strSearchResult & "<b>" & ReplaceText(rsSearch("PhotoName"), 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>"
Content = Left(Replace(Replace(ReplaceText(nohtml(rsSearch("PhotoIntro")), 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
strSearchResult = strSearchResult & "<br>"
PhotoNum = PhotoNum + 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, iCount, PhotoNum, arrPhotoID, Content
Dim arrTemp
Dim strPhotoPic, strPicTemp, arrPicTemp
Dim arrClassID, IncludeChild, iSpecialID, ItemNum, IsHot, IsElite, Author, DateNum, OrderType, UsePage, TitleLen, ContentLen
Dim iCols, iColsHtml, iRows, iRowsHtml, iNumber
Dim rsField, ArrField, iField
Dim rsCustom, strCustomList
iCount = 0
strCustomList = ""
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)
arrPhotoID = GetSearchResultIDArr(iChannelID)
If arrPhotoID = "" Then
GetSearchResultLabel = "<p align='center'><br><br>" & R_XmlText_Class("ShowSearch/NoFound", "没有或没有找到任何{$ChannelShortName}") & "<br><br></p>"
Set rsSearch = Nothing
Exit Function
End If
Set rsField = Conn.Execute("select FieldName,LabelName from PE_Field where ChannelID=-3 or ChannelID=" & ChannelID & "")
If Not (rsField.BOF And rsField.EOF) Then
ArrField = rsField.getrows(-1)
End If
Set rsField = Nothing
sqlSearch = "select P.ChannelID,P.PhotoID,P.PhotoName,P.Author,P.UpdateTime,P.Hits,"
If IsArray(ArrField) Then
For iField = 0 To UBound(ArrField, 2)
sqlSearch = sqlSearch & "P." & ArrField(0, iField) & ","
Next
End If
sqlSearch = sqlSearch & "P.InfoPurview,P.Keyword,P.InfoPoint,P.DayHits,P.WeekHits,P.MonthHits,P.PhotoThumb,P.OnTop,P.Elite,P.PhotoIntro,P.Editor,P.Inputer,P.CopyFrom,P.ChannelID,P.Stars,C.ClassID,C.ClassName,C.ParentDir,C.ClassDir,C.ClassPurview,C.ReadMe from PE_Photo P left join PE_Class C on P.ClassID=C.ClassID where PhotoID in (" & arrPhotoID & ") order by PhotoID desc"
Set rsCustom = Server.CreateObject("ADODB.Recordset")
rsCustom.Open sqlSearch, Conn, 1, 1
Do While Not rsCustom.EOF
If iChannelID = 0 Then
If rsCustom("ChannelID") <> PrevChannelID Then
Call GetChannel(rsCustom("ChannelID"))
PrevChannelID = rsCustom("ChannelID")
End If
End If
strTemp = strList
iNumber = (CurrentPage - 1) * MaxPerPage + iCount + 1
strTemp = PE_Replace(strTemp, "{$Number}", iNumber)
strTemp = PE_Replace(strTemp, "{$ClassID}", rsCustom("ClassID"))
strTemp = PE_Replace(strTemp, "{$ClassName}", rsCustom("ClassName"))
strTemp = PE_Replace(strTemp, "{$ParentDir}", rsCustom("ParentDir"))
strTemp = PE_Replace(strTemp, "{$ClassDir}", rsCustom("ClassDir"))
strTemp = PE_Replace(strTemp, "{$Readme}", rsCustom("ReadMe"))
If InStr(strTemp, "{$ClassUrl}") > 0 Then strTemp = PE_Replace(strTemp, "{$ClassUrl}", GetClassUrl(rsCustom("ParentDir"), rsCustom("ClassDir"), rsCustom("ClassID"), rsCustom("ClassPurview")))
strTemp = PE_Replace(strTemp, "{$PhotoID}", rsCustom("PhotoID"))
If InStr(strTemp, "{$PhotoUrl}") > 0 Then strTemp = PE_Replace(strTemp, "{$PhotoUrl}", GetPhotoUrl(rsCustom("ParentDir"), rsCustom("ClassDir"), rsCustom("UpdateTime"), rsCustom("PhotoID"), rsCustom("ClassPurview"), rsCustom("InfoPurview"), rsCustom("InfoPoint")))
If InStr(strTemp, "{$UpdateDate}") > 0 Then strTemp = PE_Replace(strTemp, "{$UpdateDate}", FormatDateTime(rsCustom("UpdateTime"), 2))
strTemp = PE_Replace(strTemp, "{$UpdateTime}", rsCustom("UpdateTime"))
strTemp = PE_Replace(strTemp, "{$Stars}", GetStars(rsCustom("Stars")))
strTemp = PE_Replace(strTemp, "{$Author}", rsCustom("Author"))
strTemp = PE_Replace(strTemp, "{$CopyFrom}", rsCustom("CopyFrom"))
strTemp = PE_Replace(strTemp, "{$Hits}", rsCustom("Hits"))
strTemp = PE_Replace(strTemp, "{$Inputer}", rsCustom("Inputer"))
strTemp = PE_Replace(strTemp, "{$Editor}", rsCustom("Editor"))
If InStr(strTemp, "{$InfoPoint}") > 0 Then strTemp = PE_Replace(strTemp, "{$InfoPoint}", GetInfoPoint(rsCustom("InfoPoint")))
If InStr(strTemp, "{$PhotoPoint}") > 0 Then strTemp = PE_Replace(strTemp, "{$PhotoPoint}", GetInfoPoint(rsCustom("InfoPoint")))
If InStr(strTemp, "{$Keyword}") > 0 Then strTemp = PE_Replace(strTemp, "{$Keyword}", GetKeywords(",", rsCustom("Keyword")))
If rsCustom("OnTop") = True Then
strTemp = PE_Replace(strTemp, "{$Property}", "OnTop")
ElseIf rsCustom("Elite") = True Then
strTemp = PE_Replace(strTemp, "{$Property}", "Elite")
ElseIf rsCustom("Hits") > HitsOfHot Then
strTemp = PE_Replace(strTemp, "{$Property}", "Hot")
Else
strTemp = PE_Replace(strTemp, "{$Property}", "Common")
End If
If rsCustom("OnTop") = True Then
strTemp = PE_Replace(strTemp, "{$Top}", strTop2)
Else
strTemp = PE_Replace(strTemp, "{$Top}", "")
End If
If rsCustom("Elite") = True Then
strTemp = PE_Replace(strTemp, "{$Elite}", strElite2)
Else
strTemp = PE_Replace(strTemp, "{$Elite}", "")
End If
If rsCustom("Hits") > HitsOfHot Then
strTemp = PE_Replace(strTemp, "{$Hot}", strHot2)
Else
strTemp = PE_Replace(strTemp, "{$Hot}", "")
End If
If TitleLen > 0 Then
strTemp = PE_Replace(strTemp, "{$PhotoName}", GetSubStr(rsCustom("PhotoName"), TitleLen, ShowSuspensionPoints))
Else
strTemp = PE_Replace(strTemp, "{$PhotoName}", rsCustom("PhotoName"))
End If
strTemp = PE_Replace(strTemp, "{$PhotoNameOriginal}", rsCustom("PhotoName"))
If ContentLen > 0 Then
If InStr(strTemp, "{$PhotoIntro}") > 0 Then strTemp = PE_Replace(strTemp, "{$PhotoIntro}", Left(nohtml(rsCustom("PhotoIntro")), ContentLen))
Else
strTemp = PE_Replace(strTemp, "{$PhotoIntro}", "")
End If
If InStr(strTemp, "{$PhotoThumb}") > 0 Then strTemp = PE_Replace(strTemp, "{$PhotoThumb}", GetPhotoThumb(rsCustom("PhotoThumb"), 130, 0))
If InStr(strTemp, "{$DayHits}") > 0 Then strTemp = PE_Replace(strTemp, "{$DayHits}", GetHits(rsCustom("InfoPoint"), rsCustom("DayHits"), 1))
If InStr(strTemp, "{$WeekHits}") > 0 Then strTemp = PE_Replace(strTemp, "{$WeekHits}", GetHits(rsCustom("InfoPoint"), rsCustom("WeekHits"), 2))
If InStr(strTemp, "{$MonthHits}") > 0 Then strTemp = PE_Replace(strTemp, "{$MonthHits}", GetHits(rsCustom("InfoPoint"), rsCustom("MonthHits"), 3))
'替换图片缩略图
regEx.Pattern = "\{\$PhotoThumb\((.*?)\)\}"
Set Matches = regEx.Execute(strTemp)
For Each Match In Matches
arrPicTemp = Split(Match.SubMatches(0), ",")
strPhotoPic = GetPhotoThumb(Trim(rsCustom("PhotoThumb")), PE_CLng(arrTemp(0)), PE_CLng(arrTemp(1)))
strTemp = Replace(strTemp, Match.value, strPhotoPic)
Next
If IsArray(ArrField) Then
For iField = 0 To UBound(ArrField, 2)
strTemp = PE_Replace(strTemp, ArrField(1, iField), PE_HTMLEncode(rsCustom(Trim(ArrField(0, iField)))))
Next
End If
strCustomList = strCustomList & strTemp
rsCustom.MoveNext
iCount = iCount + 1
If iCols > 1 And iCount Mod iCols = 0 Then strCustomList = strCustomList & iColsHtml
If iRows > 1 And iCount Mod iCols * iRows = 0 Then strCustomList = strCustomList & iRowsHtml
If iCount >= MaxPerPage Then Exit Do
Loop
rsCustom.Close
Set rsCustom = Nothing
GetSearchResultLabel = strCustomList
End Function
'=================================================
'函数名:GetCorrelative
'作 用:显示相关图片
'参 数:PhotoNum ----最多显示多少个图片
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
Private Function GetCorrelative(PhotoNum, TitleLen)
Dim rsCorrelative, sqlCorrelative, strCorrelative
Dim strKey, arrKey, i, MaxNum
If PhotoNum > 0 And PhotoNum <= 100 Then
sqlCorrelative = "select top " & PhotoNum
Else
sqlCorrelative = "Select Top 5 "
End If
strKey = Mid(rsPhoto("Keyword"), 2, Len(rsPhoto("Keyword")) - 2)
If InStr(strKey, "|") > 1 Then
arrKey = Split(strKey, "|")
MaxNum = UBound(arrKey)
If MaxNum > 2 Then MaxNum = 2
strKey = "((P.Keyword like '%|" & arrKey(0) & "|%')"
For
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -