468,257 Members | 1,419 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

highlighting search term results

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.
Jul 17 '05 #1
2 2125
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

Jul 17 '05 #2
On Sun, 24 Oct 2004 16:54:42 GMT, leegold2 <le*****@nospam.net> wrote:
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".


http://www.alistapart.com/articles/searchhighlight/

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by George | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.