wilorichie Posted March 26, 2007 Share Posted March 26, 2007 Anyone able to point me in the direction of a no database php search tutorial or throw up an example. Basically, I need to search for non HTML elements pages within a directory. Link to comment https://forums.phpfreaks.com/topic/44424-search-without-sql-database/ Share on other sites More sharing options...
hitman6003 Posted March 27, 2007 Share Posted March 27, 2007 What do you mean by "non HTML elements pages"? You can use the dir class to open a directory, the read through the files, select the ones you want, then use file_get_contents to read the file and use strpos and the regex functions to search for your string. http://www.php.net/dir http://www.php.net/file_get_contents http://www.php.net/strpos Link to comment https://forums.phpfreaks.com/topic/44424-search-without-sql-database/#findComment-215783 Share on other sites More sharing options...
wilorichie Posted March 27, 2007 Author Share Posted March 27, 2007 I have a large site where new pages are constantly being added. I want to be able to automatically search any php file in any directory from /root/ to check if $search matches anything within <body></body> tags that is NOT HTML. What you said sounds like the logic behind it though. The more tips / tutorial / examples the better Thank you for your help though, hitman Link to comment https://forums.phpfreaks.com/topic/44424-search-without-sql-database/#findComment-215789 Share on other sites More sharing options...
hitman6003 Posted March 27, 2007 Share Posted March 27, 2007 Once you get above a few tens of files this process will get very very slow and cumbersome. You may want to look into a CMS or some other method that will store your data in a database that can be easily searched. You may even consider a cron job that will parse your files and insert them into a database that has a fulltext index set up for the field. Link to comment https://forums.phpfreaks.com/topic/44424-search-without-sql-database/#findComment-215798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.