highlight search word

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HormonX
Forum Commoner
Posts: 50
Joined: Tue Dec 10, 2002 7:43 pm
Location: Toronto

highlight search word

Post by HormonX »

Can anyone point me in a right direction on how to highlight a word that user has been searching for ?

thank you

Greg
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

str_replace the searched word with a css-class that does the highlightning...

Code: Select all

Original text: Foo is something bar I say! Har har...
Searching for: bar
New text after str_replace: Foo is something <b class="h">bar</b> I say! Har har...
...just to name one ill-written example. But it's an direction... =)
Post Reply