highlighting search term results

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • leegold2

    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.
  • Janwillem Borleffs

    #2
    Re: highlighting search term results

    leegold2 wrote:[color=blue]
    > I know I need, ob_start();
    > Then I process to highlight the search term hits, then I flush the
    > buffer to render the page.
    >[/color]

    Actually, when preforming local (database) searches, you don't. It all
    comes down to highlight the appropriate pieces of text.
    [color=blue]
    > 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".
    >[/color]

    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:



    I have also an example which applies a search on the file system (warning:
    str_ireplace() is supported in PHP version >= 5):




    HTH;
    JW



    Comment

    • usenet@isotopeREEMOOVEmedia.com

      #3
      Re: highlighting search term results

      On Sun, 24 Oct 2004 16:54:42 GMT, leegold2 <leegold@nospam .net> wrote:
      [color=blue]
      > 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".[/color]

      Google’s cache offers users a copy of your website with their search terms highlighted. You can do the same thing and make it easier for users to find what they’re looking for — w…


      Comment

      Working...