TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   need help for highlighted keyword search result (http://www.talkphp.com/absolute-beginners/2197-need-help-highlighted-keyword-search-result.html)

meshi 02-06-2008 01:47 PM

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

flyingbuddha 02-07-2008 04:39 PM

Hi meshi,

Perhaps you could reword your question and make it a little clearer, it's a bit confusing at the moment :)

Cheers.


All times are GMT. The time now is 11:55 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0