Copy link to clipboard
Copied
Hi Guys,
I am building a site with a search function. I created the text box and button using <form> tags. I need to write a script or php code that will search the site and return search results within the site and not on google and it shouldn't include google adds. I have found many tutorials but they all use the google search on the site so it either returns the results in google and when it returns the results locally then it inludes google adds.
I am completely stuck on the coding of the search function. Please can anyone assist in how the script should look and please can you also explain where the code needs to be inserted (in terms of, should it be the button action on_submit or how do I call the functions). I want to copy this code into my dreamweaver template to apply across all pages.
I can program a little but not a master by any stretch of the imagination. Can anyone please guide me in the right direction or maybe post the code that will perform the search. I know I am asking alot but I did not know where else to turn.
Thanks,
Owen
Copy link to clipboard
Copied
Using a server side script to dynamically search through your site files is slow and should be avoided. You need to use a search engine that indexes your pages. There are several options.
1) Use a 3rd party search engine like Wrensoft Zoom that indexes your site and stores the results
2) Store you 'search results' manually in a SQL database.
3) Search the web for free seach engine scripts.
Option 1 and 3 are fairly effortless.
Option 2 requires some work and working knowledge of scripting and SQL databases.
Copy link to clipboard
Copied
I vote for Zoom. It's free for indexing a cretin number of pages, like 50 or maybe even 100. It's very easy to set up if you're using a single page that contains the search form. On the last site I used it on, I had a search field on every page in the header so it took a little extra configuration. I found it to be very accurate in it's results, and even indexed dynamic pages. You can exclude folders and pages from the results if you want. After the initial indexing, you upload your pages and the supporting files it creates. After that, the only maintenance there is is to periodically re-index the site as content changes.