Highlight keyword or parts there of...
Posted: Tue Apr 15, 2003 9:33 am
I have been trying all weekend to get t his to work. I am able to do a keyword search where the keyword is highlighted upon display, what I also want to be able to do is highlight parts of words or phrases that contain the keyword.
EX: if $keyword = "Windows 2000", and the search returns
Windows 2000
Windows 2000 Server
I want the "Windows 2000" portion of both highlighted, not just the "Windows 2000" one.
Right now I am using a very simple highlight function, just a simple little code string
I tried ereg_replace, but don't think I have enough experience with it to make it work properly.
Any help is greatly appreciated.
EX: if $keyword = "Windows 2000", and the search returns
Windows 2000
Windows 2000 Server
I want the "Windows 2000" portion of both highlighted, not just the "Windows 2000" one.
Right now I am using a very simple highlight function, just a simple little code string
Code: Select all
<?php
if ($_SESSION[keyword] == "$compatable_os" || $_SESSION[keyword] == ucfirst($compatable_os) || $_SESSION[keyword] == strtolower($compatable_os) || $_SESSION[keyword] == strtoupper($compatable_os)):
$compatable_os = "<span class = 'highlite'>$compatable_os</span>";
endif;
?>Any help is greatly appreciated.