Ask a Question related to PHP Development, Design and Development.
-
leegold2 #1
highlighting search terms 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.
leegold2 Guest
-
Verity pdf search term highlighting
Hi. This is my really tough question: Is there any way to use Verity's PageMap field with ColdFusion? When indexing a collection Verity's PDF... -
verity search terms
Why is it that verity searches require the AND and OR operators instead of just saying that by default there's an AND between words? For example,... -
Highlighting Search Entries in Webhelp
How can I turn on the highlighting feature for Webhelp when searching? It doesn't work the same way as RoboHTML help. It was working and now it... -
[PHP] highlighting multi term search results
jonas_weber@gmx.ch wrote: Highlight the longest words first? -- ---John Holmes... Amazon Wishlist:... -
highlighting multi term search results
hi, i'm working on a function that highlights search results. problem: a search input like "te est"; two terms that match one word ("test"). the... -
Janwillem Borleffs #2
Re: highlighting search terms results
leegold2 wrote:
Do not multi-post! Thread already started in comp.lang.php>
JW
Janwillem Borleffs Guest
-
Oli #3
Re: highlighting search terms results
If your target string is $str and your search terms are in the array $Terms:
<?php
// create replacement HTML strings
foreach ($Terms as $Term)
{
$Reps[] = "<B>" . $Term . "</B>";
}
// perform replacements
$strOut = str_ireplace($Terms, $Reps, $str);
?>
Replace the <B></B> tags with whatever HTML highlighting you want.
I can't see any reason why you'd specifically need to use output buffering
with ob_start().
Hope this helps.
Oli
Oli Guest



Reply With Quote

