I am trying to get the following script to filter out a lengthy list of unfavorable words (in a text file?), but i am extremely lost. Any help would be greatly appreciated.
it's hard to understand what your posted code is doing...
but if you are retrieving the unfavorable words from a database, you could easily build your own array with words (and replacements) and then perform a strreplace or a preg_replace
I was hoping to put the bad words in a text file on the server that i could update frequently. And there is no need to replace the terms, just show actual terms that are filtered... What do you think? And thanks for responding.
Now, here, we know the source of keywords/badwords and we know the procedure for replacing/highlighting but where do we have to search them. you don't mention that anywhere...
I don't want them replaced; just removed from the original query. The page this code resides on pulls all of the search terms out of the db and displays everything. I want to be able to create a text file on the server that has a list of terms to remove from the display... Does that make sense?
If I understand you correctly, you should probably use a loop to remove all of the bad words from the DB first, and then you can just get the full contents of the DB, and don't worry about the bad words. I don't know if it's possible to do it on the fly like you want...
I think the probablem with removing the terms from the DB is that they are constantly being put back in by users and other search engines. Can I use the loop method in an environment like this and, if yes, how?