This search tool allows you to search for words or phrases on your site, and the resulting page will display the title of your visitors page and a link to it.
You only need to include bellows in the form of your Web page:
HTML page.
And you will need to create a file, the content table in the bellow named searchfiles.asp in the corresponding directory. The server that must be available in Active Server Pages. Instructions are at the bottom.
<%
Searchterm = Request.Form ("term")
novalid= "A b c D e F g h i j k l m n o p q R S t u v w x y z Yes No and more"
novalidresponse = "Go back and try again." Your search term is very common "
If InStr (Searchterm,novalid) =0 Then
Response. Write ("<CENTER><H2>Search results</H2></CENTER>")
Foldername= "FolderName"
Showlist ()
Else
Response.Write Novalidresponse
End If
Searchresponse= ""
%>
<%
Sub showlist ()
Foldertocheck = Server.MapPath ("") & "/" & FolderName & "/"
Dim FS, F, F1, FC, S
Set fs = CreateObject ("Scripting.FileSystemObject")
Set f = fs. GetFolder (Foldertocheck)
Set FC = F.files
For each F1 in FC
wfile = F1.name
If Right (wfile, 5) = ". html" OR right (wfile, 4) = ". htm" then
& nbsp; Wfile2 = foldertocheck & Wfile
Set fs = CreateObject ("Scripting.FileSystemObject")
Set a = fs. OpenTextFile (Wfile2)
ct = a.readall
A.close
ct2=lcase (CT)
SearchTerm2 = LCase (searchterm)
If InStr (Ct2,searchterm2) >0 Then
If InStr (CT, "</title>") >0 Then
LONGITUD=INSTR (CT, "</title>")
Longitud=longitud-1
Ct=left (Ct,longitud)
Longitud2=len (CT)
LONGITUD=INSTR (CT, "<title>")
Longitud=longitud2-longitud-6
Ct=right (Ct,longitud)
Else
If InStr (CT, "</TITLE>") >0 Then
LONGITUD=INSTR (CT, "</TITLE>")
Longitud=longitud-1
Ct=left (Ct,longitud)
Longitud2=len (CT)
LONGITUD=INSTR (CT, "<TITLE>")
Longitud=longitud2-longitud-6
Ct=right (Ct,longitud)
End If
End If
searchresponse= SearchResponse + "<TR><TD>" + ct + "</td><td align=center valign=middle>" + "< A href= "+"/"+ FolderName +"/"+ Wfile +" > more </A></TD></TR>
Longitud=0
Ct= ""
End If
End If
Next
Response.Write ("
Response.Write ("<table border=0 width=550><tr><td bgcolor=c0c0c0><font SIZE=5><B> Search results</b></font></td></tr></table> ")
Response.Write ("<table border=0 width=550>")
If searchresponse<> "" Then
Response.Write SearchResponse
Else
Response.Write ("<tr><td>the specified term or phrase is not found</td></tr>")
End If
Response.Write ("</TABLE>")
Response.Write ("</CENTER></BODY></HTML>")
End Sub
%>
You may contain a variable "novalid" that you do not want to be searched for. If the term is included in the "Novalid" requirement, compose your response variable "novalidresponse".
The text of the search results appears on the search results page above.
"Folder" is the directory search that you want. Only ". Heat medium "and". The HTML "files in this directory will be searched. Subdirectories do not search. If you want to search your top-level directory, set the folder = "". This script is only available in the most useful directory only. I do not recommend checking for more than 50 files (try friendly with your server!). )
This script will display the term phrase required by the page in response to the title list.