Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Searching Using ASP

Status
Not open for further replies.

mohaimen

Programmer
Dec 24, 2001
25
0
0
BD
Hi,

I am trying to develop an ASP page for one of the websites I am developing that will be used to search words in the site and display results like Google or Yahoo. Can anyone tell me which VB Script function to use?

Regards.

Mohaimen
 
No function will do this for you, but a mix of different techniques.
The steps you'll need to take in the easiest developmental wise process to perform this are
1) Create the form for the user interaction.

2) FileSystemObject (better known as FSO)
Use this object to get all the files in the directories you wish to search. Then you need to bring them in and loop through them. The common way to either include or not include files is a content meta tag or whatever stating a term such as, NOINDEX or INDEX.

3) while looping through the files you can use InStr() (or a more advanced way with regular expressions) to validate text values the user entered against the contents of the file.
If InStr(fileContents, userValue) > 0 Then
Match found
End If

4) At this point you would have created a running variable to hold the files that were found to contain the values entered. All you need to do now is construct a link from that file name. So say the variable you created has a delimiter of #### and you found all these files to hold the word "database"
filesFound = databaseConcepts.asp####mydatabaseresults.asp

What you need to do is just split on the #### delimiter and then construct the links

mylinks = split(filesFound,"####")

Do while x <= ubound(myLinks)
response.write &quot;<a href='&quot; & myLinks & &quot;'>&quot;
x = x + 1
Loop

Of course formatting etc. set aside.
So other then a chopped up explanation and list this should get you going in what you need to first
Research and then what step to take in what order.

____________________________________________________
[sub]The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811[/sub]
onpnt2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top