nick1 wrote:Greetings,
Well, as the subject of this thread says. I'm wanting to create an
option on my website that allows visitors to search the entire site for
the phrase they enter into a form. Clicking the submit button will fire
off the search and return links to pages that contain their search phrase.
Do you know of a way to create this using just HTML or PHP? I'd prefer
not to use a MySQL database or some third party software/script. I'd like to write my own script and keep it simple as possible. Any advice would be greatly appreciated.
Thank you for your time,
Nick
You can use google if they have your whole site indexed. If you're not using a database for your content, most solutions to this problem will be pretty ugly. MySQL makes this pretty swift these days with their "full text" indexing, but if all your content is in static html files, you'd have to do a lot of work no matter how you slice it.
To do it the google way, do an advanced search and set the domain field to your site. The resulting output will be "site:www.yourdomain.com [search terms]" - you'll see that in the search box after you click the Google Search button. Anyway, take a look at the query string on the resulting page. You can post to that form or even build that url from within your site and parse the results out in your own page/templating system.
I'm pretty sure they make it even easier by giving you the code and everything, but you might have to have a google AdWords account or something. I'm not sure about that though...maybe someone else has some input.