Page 1 of 1

Php script for searching static website

Posted: Fri Aug 14, 2009 5:09 am
by shakeeb
Hi All,

I have a static website containing html pages aroud 50 to 60 pages, no database nothing,
Now I need a search module in this, I want to add a php script for this searching, I know how to
search from DB using php, But static pages no clue,
Any one has done this any idea any hint :?:

Thanks,
Shakeeb

Re: Php script for searching static website

Posted: Fri Aug 14, 2009 5:16 am
by onion2k
Essentially you'll have to open each file (with file_get_contents() or whatever) and search it (with strpos() or a regexp). It'll be hellishly slow. I'd build something to scan through each file, take the words, and put them into a database table with a link to whichever file they're in. Then search that.