This is a discussion on highlighting search term results within the PHP Language forums, part of the PHP Programming Forums category; I've seen previous threads but I still need help in highlighting search terms like google does on their search ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've seen previous threads but I still need help in highlighting
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 the "puzzle". Thanks, Lee G. |
|
|||
|
leegold2 wrote:
> I know I need, ob_start(); > Then I process to highlight the search term hits, then I flush the > buffer to render the page. > Actually, when preforming local (database) searches, you don't. It all comes down to highlight the appropriate pieces of text. > 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 > the "puzzle". > 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 fragments only. 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: http://www.jwscripts.com/playground/highlight.phps I have also an example which applies a search on the file system (warning: str_ireplace() is supported in PHP version >= 5): http://www.jwscripts.com/playground/search-eng.phps HTH; JW |