View Full Version : basic (small-scale) search

09-17-2005, 04:00 PM
without using indexes or involving other technologies, is there a 'better' way to slog through pages looking for keywords? right now i loop through root, open all the text files (as determined by checking filename against an array of 'ok' extensions) with file_get_contents and check for the search term with strpos. each of the subdirs calls the same function on itself. results echoed as links.

09-17-2005, 07:14 PM
For a file based system, this is really the only way and I would HIGHLY reccomend devising some kind of indexing system. Personally, I would rather use MySQL database which would allow you to perform fast searches... If you are planning on expanding your web page I would reccomend that you try and make use of MySQL (assuming you have it available).

If you don't have MySQL at your disposal I would try and create some kind of custom index. As it sounds like you dont have *alot* I would possibly use arrays and store the keywords that way.

09-18-2005, 02:20 PM
gracias :)