View Single Post
Old 02-06-2008, 01:47 PM   #1 (permalink)
meshi
The Contributor
Upcoming Programmer 
 
meshi's Avatar
 
Join Date: Oct 2007
Posts: 44
Thanks: 0
meshi is on a distinguished road
Default 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
meshi is offline  
Reply With Quote