highlighting text

liunx

Guest
Does anybody know how to highlight text that relates to a search keyword that has been entered? As in if I searched for "does" in this question then the first word would be highlighted.<br />
Thanks<br />
IxxI<!--content-->Can we do that using PHP ?<br />
I have following script , which searches file for a keyword(Search String) , If it is there it<br />
will store the filename. Finally list of files which are stored in an array displayed using an array.<br />
BUT the thing is : while displaying search results <br />
we need to display the file name + some content of file in which key words should be highlighted.<br />
Can we do like that ???<br />
<br />
<br />
$data=fread(fopen("somefile","r"),filesize("somefile"));<br />
if(eregi("$keyword",$data))<br />
{<br />
$array[]="somefile";<br />
}<!--content-->......... in which key words should be highlighted.<br />
Can we do like that ???<br />
<br />
<br />
Yes (<!-- m --><a class="postlink" href="http://www.google.com/search?q=php+highlight+search+result&sourceid=opera&num=0&ie=utf-8&oe=utf-8">http://www.google.com/search?q=php+high ... 8&oe=utf-8</a><!-- m -->).<!--content-->
 
Back
Top