02-06-2008, 01:47 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Oct 2007
Posts: 44
Thanks: 0
|
need help for highlighted keyword search result
this is my function
PHP Code:
function highlight($result,$search)
{
$keywords = split(" ",$search);
for ($i=0; $i<count($keywords ); $i++) {
$replace = $keywords[$i];
if ($replace!='')
$result = eregi_replace($keywords[$i],'<span class="z">'.$replace.'</span>', $result);
};
return $result;
}
If $result=class is the best classes at z
and $search is=class c z
the output should highlight the class z and c
the problem is it has embedded code in it.say for example
classclass="z"> is the best classclass="z"> and cclass="z">
how would i get rid of that
|
|
|
|