Jump to content

Search without SQL Database


wilorichie

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.