Php script for searching static website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shakeeb
Forum Newbie
Posts: 4
Joined: Fri Aug 07, 2009 7:14 am

Php script for searching static website

Post 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
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Php script for searching static website

Post 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.
Post Reply