Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- highlighting search term results
October 24, 2004, 9:54 pm
rate this thread
search terms like google does on their search result page.
I know I need, ob_start();
Then I process to highlight the search term hits, then I flush the
buffer to render the page.
I'm comfortable with PHP coding but what I need is simple step by step
help, with a simple search form example.
The explanations I see are either way to lofty or too small a piece of
- Janwillem Borleffs
October 25, 2004, 6:38 am
Re: highlighting search term results
Actually, when preforming local (database) searches, you don't. It all
comes down to highlight the appropriate pieces of text.
Then, explain in more detail what the requirements are. If you want to do it
like Google, you don't have to worry about tags, because Google indexes text
On the other hand, when there are html tags in text matches, the following
snippet I posted a while ago might be of interest to you:
I have also an example which applies a search on the file system (warning:
str_ireplace() is supported in PHP version >= 5):