i have one static site...
can any one please help to search the whole static site with search textbox...
Any ideas and help would be appreciated....

8 Years
Discussion Span
Last Post by nil_gh_80

I'm thinking with PHP you can just use str_match. But if you want something a bit more advanced, have you every looked at Sphider?


I don't know of any specific search utilities to search a static site, but I'm sure there are some out there...simply because I know I could do it, so others must have already done it.

You can open and parse html files using PHP (using the DOM functions) and thus index the content of your site. You could also set up excluded or white-list only directories for your index.

From here you could have a search box that returned the URLs to the static html pages on your site by order of relevance. It would be a lot of work to create the relevance algorithms, so you probably want to find someone who has already done this.

All you would need is one PHP script for indexing and one for returning the indexed results and either a flat-file database (XML, plain text, etc) or other accessible data source to hold your index data.

Google is your friend.


thanks for your quick responses above...
sorry for my bad post above...
my site is full of html and js files..
and i have one search text box,with how can i search the entire site....


I'm too tired right now to give a long reply, but javascript alone is not cut out for searching a website, but it can be used to read a file of already indexed results. I would have to experiment but I believe you can write a javascript src include tag with javascript and have it load a new file...will look into this again maybe tomorrow.

What you need is a tool that will go through each of your html pages and dig the content out of the formatting tags. Then based on a search-indexing algorithm list the results for keywords and key phrases in an order of relevance and associated with the path to that html file (the URL link on your site)...This indexed data could be written in a format that javascript can read and then you could display the results with javascript if you prefer...or you could use Ajax (PHP + JavaScript) or you could write the results directly with PHP.

This is a good job for PHP (or Perl). But I would look at what is already out there, and I haven't done my homework in this department so can't give you any recommendations.

Search Engine Watch is a site that has been around a long time, and so I often trust their info.

I wish you luck


I'm thinking with PHP you can just use str_match. But if you want something a bit more advanced, have you every looked at Sphider?

thanx buddy Sphider is just great................


hi shanti,
here is attachment which can solve your problem(i think:-/ )

Hi praveen,

How to configure this files for serarching...??? plz help

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.