search.asp

来自「1.支持文章」· ASP 代码 · 共 488 行 · 第 1/2 页

ASP
488
字号
       FolderNameAndLinkStr = "[" & KSCMS.GetFolderNameAndLink(RS("Tid"), "target=""_blank""", "") & "]"
	   TempTitle = "<a href=""" & KSCMS.GetInfoUrl(2,RS) & """ target=""_blank"">" & Replace(RS("Title"),KeyWord,"<font color=red>" & KeyWord &"</font>") & "</a>"

	   Response.Write "<tr><td height=""20""><strong>" & N & "</strong>." & FolderNameAndLinkStr & "<strong>" & TempTitle & "</strong>&nbsp;[" & RS("Author") & "][" & RS("Adddate") & "]</TD></tr>" & vbcrlf
	   Response.Write "<tr><td height=""50"">&nbsp;&nbsp;&nbsp;&nbsp;" & Replace(KSCMS.GotTopic(Replace(Replace(Replace(KSCMS.LoseHtml(RS("PictureContent")), vbCrLf, ""), "[NextPage]", ""), "&nbsp;", ""),200),KeyWord,"<font color=red>" & KeyWord & "</font>") & "……</td></tr>" & vbcrlf
	    I = I + 1
        If I >= MaxPerPage Then Exit Do
        RS.MoveNext
	Loop

        Response.Write "<tr><td height='26' colspan='6' align='right'>"
        Call KSCMS.ShowPageParamter(totalPut, MaxPerPage, "Search.asp", True, "张", CurrentPage, "SearchType=" & SearchType & "&ClassID=" & ClassID & "&KeyWord=" & KeyWord & "&ChannelID=" & ChannelID )
		Response.Write "</td></tr>" & vbcrlf
        Response.Write"  </table>" & vbcrlf
  End Sub

    Sub DownSearchResult() '下载搜索处理
   Dim SqlStr
  SqlStr="Select ID,Tid,Title,AddDate,Author,DownContent,Fname,InfoPurview,ReadPoint From KS_DownLoad Where Verific=1 And DelTF=0 "
  Select Case SearchType
   Case 1
     SqlStr=SqlStr & " And Title Like '%" & KeyWord & "%'"
   Case 2
     SqlStr=SqlStr & " And DownContent Like '%" & KeyWord & "%'"
   Case 3
     SqlStr=SqlStr & " And Author Like '%" & KeyWord & "%'"
   Case 4
     SqlStr=SqlStr & " And DownInput Like '%" & KeyWord & "%'"
   Case 5
     SqlStr=SqlStr & " And KeyWords Like '%" & KeyWord & "%'"
   Case else
     SqlStr=SqlStr & " And (Title Like '%" & KeyWord & "%' Or Author Like '%" & KeyWord & "%')" 
  End Select
    If ClassID<>"0" Then
     SqlStr=SqlStr & " And Tid='" & ClassID & "'"
   End IF
     SqlStr=SqlStr & " Order By AddDate Desc"

  Response.Write "<table width=""98%"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">" & vbcrlf
  Set RS=Server.CreateObject("ADODB.RECORDSET")
  RS.Open SqlStr,Conn,1,1
  IF RS.Eof And RS.Bof Then
      Response.Write "<tr><td>没有或没有找到任何信息</td></tr>"
  Else
                    TotalPut = RS.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 ShowDownContent()
                    Else
                        If (CurrentPage - 1) * MaxPerPage < totalPut Then
                            RS.Move (CurrentPage - 1) * MaxPerPage
                            Call ShowDownContent()
                        Else
                            CurrentPage = 1
                            Call ShowDownContent()
                        End If
                    End If
    End IF
	RS.Close
	Set RS=Nothing
  End Sub
  
    Sub ShowDownContent()   '显示下载搜索结果
       Dim N,FolderNameAndLinkStr,TempTitle
	   N=(CurrentPage-1)*MaxPerPage
      Do While Not RS.Eof
	   N=N+1
       FolderNameAndLinkStr = "[" & KSCMS.GetFolderNameAndLink(RS("Tid"), "target=""_blank""", "") & "]"
	   TempTitle = "<a href=""" & KSCMS.GetInfoUrl(3,RS) & """ target=""_blank"">" & Replace(RS("Title"),KeyWord,"<font color=red>" & KeyWord &"</font>") & "</a>"

	   Response.Write "<tr><td height=""20""><strong>" & N & "</strong>." & FolderNameAndLinkStr & "<strong>" & TempTitle & "</strong>&nbsp;[" & RS("Author") & "][" & RS("Adddate") & "]</TD></tr>" & vbcrlf
	   Response.Write "<tr><td height=""50"">&nbsp;&nbsp;&nbsp;&nbsp;" & Replace(KSCMS.GotTopic(Replace(Replace(Replace(KSCMS.LoseHtml(RS("DownContent")), vbCrLf, ""), "[NextPage]", ""), "&nbsp;", ""),200),KeyWord,"<font color=red>" & KeyWord & "</font>") & "……</td></tr>" & vbcrlf
	    I = I + 1
        If I >= MaxPerPage Then Exit Do
        RS.MoveNext
	Loop

        Response.Write "<tr><td height='26' colspan='6' align='right'>"
        Call KSCMS.ShowPageParamter(totalPut, MaxPerPage, "Search.asp", True, "个", CurrentPage, "SearchType=" & SearchType & "&ClassID=" & ClassID & "&KeyWord=" & KeyWord & "&ChannelID=" & ChannelID )
		Response.Write "</td></tr>" & vbcrlf
        Response.Write"  </table>" & vbcrlf
  End Sub

  Sub FlashSearchResult() 'Flash搜索处理
    Dim SqlStr
    SqlStr="Select ID,Tid,Title,AddDate,Author,FlashContent,Fname,InfoPurview,ReadPoint From KS_Flash Where Verific=1 And DelTF=0 "
   Select Case SearchType
    Case 1
     SqlStr=SqlStr & " And Title Like '%" & KeyWord & "%'"
    Case 2
     SqlStr=SqlStr & " And FlashContent Like '%" & KeyWord & "%'"
    Case 3
     SqlStr=SqlStr & " And Author Like '%" & KeyWord & "%'"
    Case 4
     SqlStr=SqlStr & " And FlashInput Like '%" & KeyWord & "%'"
    Case 5
     SqlStr=SqlStr & " And KeyWords Like '%" & KeyWord & "%'"
    Case else
     SqlStr=SqlStr & " And (Title Like '%" & KeyWord & "%' Or  Author Like '%" & KeyWord & "%')" 
  End Select
    If ClassID<>"0" Then
     SqlStr=SqlStr & " And Tid='" & ClassID & "'"
  End IF
     SqlStr=SqlStr & " Order By AddDate Desc"

  Response.Write "<table width=""98%"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">" & vbcrlf
  Set RS=Server.CreateObject("ADODB.RECORDSET")
  RS.Open SqlStr,Conn,1,1
  IF RS.Eof And RS.Bof Then
      Response.Write "<tr><td>没有或没有找到任何信息</td></tr>"
  Else
                    TotalPut = RS.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 ShowFlashContent()
                    Else
                        If (CurrentPage - 1) * MaxPerPage < totalPut Then
                            RS.Move (CurrentPage - 1) * MaxPerPage
                            Call ShowFlashContent()
                        Else
                            CurrentPage = 1
                            Call ShowFlashContent()
                        End If
                    End If
    End IF
	RS.Close
	Set RS=Nothing
  End Sub
  
    Sub ShowFlashContent()   '显示Flash搜索结果
       Dim N,FolderNameAndLinkStr,TempTitle
	   N=(CurrentPage-1)*MaxPerPage
      Do While Not RS.Eof
	   N=N+1
       FolderNameAndLinkStr = "[" & KSCMS.GetFolderNameAndLink(RS("Tid"), "target=""_blank""", "") & "]"
	   TempTitle = "<a href=""" & KSCMS.GetInfoUrl(4,RS) & """ target=""_blank"">" & Replace(RS("Title"),KeyWord,"<font color=red>" & KeyWord &"</font>") & "</a>"

	   Response.Write "<tr><td height=""20""><strong>" & N & "</strong>." & FolderNameAndLinkStr & "<strong>" & TempTitle & "</strong>&nbsp;[" & RS("Author") & "][" & RS("Adddate") & "]</TD></tr>" & vbcrlf
	   Response.Write "<tr><td height=""50"">&nbsp;&nbsp;&nbsp;&nbsp;" & Replace(KSCMS.GotTopic(Replace(Replace(Replace(KSCMS.LoseHtml(RS("FlashContent")), vbCrLf, ""), "[NextPage]", ""), "&nbsp;", ""),200),KeyWord,"<font color=red>" & KeyWord & "</font>") & "……</td></tr>" & vbcrlf
	    I = I + 1
        If I >= MaxPerPage Then Exit Do
        RS.MoveNext
	Loop

        Response.Write "<tr><td height='26' colspan='6' align='right'>"
        Call KSCMS.ShowPageParamter(totalPut, MaxPerPage, "Search.asp", True, "个", CurrentPage, "SearchType=" & SearchType & "&ClassID=" & ClassID & "&KeyWord=" & KeyWord & "&ChannelID=" & ChannelID )
		Response.Write "</td></tr>" & vbcrlf
        Response.Write"  </table>" & vbcrlf
  End Sub



  Sub AllSearchResult() '搜索全部信息
   Dim SqlStr
   Dim ArticleSqlStr:ArticleSqlStr="Select C.ChannelID,A.ID,A.Tid,A.Title,A.AddDate,A.Author,A.ArticleContent,A.Fname,A.InfoPurview,A.ReadPoint From KS_Article A,KS_Class C Where A.Tid=C.ID and A.Verific=1  And A.DelTF=0  And (A.Title Like '%" & KeyWord & "%' Or A.SubTitle Like '%" & KeyWord & "%' or A.Author Like '%" & KeyWord & "%')"
   Dim PhotoSqlStr:PhotoSqlStr="Select C.ChannelID,A.ID,A.Tid,A.Title,A.AddDate,A.Author,A.PictureContent,A.Fname,A.InfoPurview,A.ReadPoint From KS_Photo A, KS_Class C Where A.Tid=C.ID and A.Verific=1  And A.DelTF=0  And (A.Title Like '%" & KeyWord & "%' Or A.Author Like '%" & KeyWord & "%')"
   Dim DownSqlStr:DownSqlStr="Select C.ChannelID,A.ID,A.Tid,A.Title,A.AddDate,A.Author,A.DownContent,A.Fname,A.InfoPurview,A.ReadPoint From KS_DownLoad A,KS_Class C Where A.Tid=C.ID and A.Verific=1  And A.DelTF=0  And (A.Title Like '%" & KeyWord & "%' Or A.Author Like '%" & KeyWord & "%')"
   Dim FlashSqlStr:FlashSqlStr="Select C.ChannelID,A.ID,A.Tid,A.Title,A.AddDate,A.Author,A.FlashContent,A.Fname,A.InfoPurview,A.ReadPoint From KS_Flash A,KS_Class C Where A.Tid=C.ID and A.Verific=1  And A.DelTF=0  And (A.Title Like '%" & KeyWord & "%' Or A.Author Like '%" & KeyWord & "%')"
    
	SqlStr=ArticleSqlStr & " Union All " & PhotoSqlStr & " Union All " & DownSqlStr & " Union All " & FlashSqlStr
	SqlStr=SqlStr & " Order By A.AddDate Desc"

  Response.Write "<table width=""98%"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">" & vbcrlf
  Set RS=Server.CreateObject("ADODB.RECORDSET")
  RS.Open SqlStr,Conn,1,1
  IF RS.Eof And RS.Bof Then
      Response.Write "<tr><td>没有或没有找到任何信息</td></tr>"
  Else
                    TotalPut = RS.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 ShowALLContent()
                    Else
                        If (CurrentPage - 1) * MaxPerPage < totalPut Then
                            RS.Move (CurrentPage - 1) * MaxPerPage
                            Call ShowALLContent()
                        Else
                            CurrentPage = 1
                            Call ShowALLContent()
                        End If
                    End If
    End IF
	RS.Close
	Set RS=Nothing
  End Sub
        Sub ShowAllContent()   '显示所有搜索结果
       Dim N,FolderNameAndLinkStr,TempTitle
	   N=(CurrentPage-1)*MaxPerPage
      Do While Not RS.Eof
	   N=N+1
       FolderNameAndLinkStr = "[" & KSCMS.GetFolderNameAndLink(RS(2), "target=""_blank""", "") & "]"
	   TempTitle = "<a href=""" & KSCMS.GetInfoUrl(RS(0),RS) & """ target=""_blank"">" & Replace(RS(3),KeyWord,"<font color=red>" & KeyWord &"</font>") & "</a>"

	   Response.Write "<tr><td height=""20""><strong>" & N & "</strong>." & FolderNameAndLinkStr & "<strong>" & TempTitle & "</strong>&nbsp;[" & RS(5) & "][" & RS(4) & "]</TD></tr>" & vbcrlf
	   Response.Write "<tr><td height=""50"">&nbsp;&nbsp;&nbsp;&nbsp;" & Replace(KSCMS.GotTopic(Replace(Replace(Replace(KSCMS.LoseHtml(RS(6)), vbCrLf, ""), "[NextPage]", ""), "&nbsp;", ""),200),KeyWord,"<font color=red>" & KeyWord & "</font>") & "……</td></tr>" & vbcrlf
	    I = I + 1
        If I >= MaxPerPage Then Exit Do
        RS.MoveNext
	Loop

        Response.Write "<tr><td height='26' colspan='6' align='right'>"
        Call KSCMS.ShowPageParamter(totalPut, MaxPerPage, "Search.asp", True, "条", CurrentPage, "SearchType=" & SearchType & "&ClassID=" & ClassID & "&KeyWord=" & KeyWord & "&ChannelID=" & ChannelID )
		Response.Write "</td></tr>" & vbcrlf
        Response.Write"  </table>" & vbcrlf
  End Sub

End Class
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?