Forums

PHP

This topic is locked

Highlight Search terms

Posted 10 Jul 2006 19:20:36
1
has voted
10 Jul 2006 19:20:36 Mark Reynolds posted:
When a search is done how can i use PHp to highlight the phrase searched for - Is this variable?

Thanks

Mark

Mark Reynolds

Replies

Replied 11 Jul 2006 13:06:15
11 Jul 2006 13:06:15 Roddy Dairion replied:
When you get the search results use the function explode(), to break the search result after every space or comma or fullstop u choose. After this your search results will be an array() use the function count() to count how many words is present in your array. Using a for loop - for() check if each word equals to the phrase being searched if found just put a style to it <font color=color>. Then just reconstruct the whole search results and you should have a highlight where phrase searched and the search result is the same.
Hope it helps.
Replied 14 Jul 2006 01:29:01
14 Jul 2006 01:29:01 Mark Reynolds replied:
Thanks roddy - is there any chance of a sample script using rsResults as a recordset?

Thanks

Mark

Mark Reynolds

Reply to this topic