View Single Post
  #1 (permalink)  
Old 07-30-2008, 09:41 PM
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 247
higlighting problem: shouldn't highlight one letter at a time

What's wrong with this:
PHP Code:
for($m=0$m <  count($bigWords); $m++){
        
$strText preg_replace("/(".$keyword[$m].")/i""<span class=\"\" id=\"\" style=\"color:".$COLORS[$m].";                             font-weight:bold;\">$1</span>"$strText);
        echo 
"<br />";
        echo 
$strText;
    } 
It's highlighting one letter at a time:
Code:
<span class="" id="" style="color:red; font-weight:bold;"></span>
t<span class="" id="" style="color:red; font-weight:bold;"></span>
h<span class="" id="" style="color:red; font-weight:bold;"></span>
e<span class="" id="" style="color:red; font-weight:bold;"></span>
 <span class="" id="" style="color:red; font-weight:bold;"></span>
w<span class="" id="" style="color:red; font-weight:bold;"></span>
h<span class="" id="" style="color:red; font-weight:bold;"></span>
o<span class="" id="" style="color:red; font-weight:bold;"></span>

 <span class="" id="" style="color:red; font-weight:bold;"></span>
a<span class="" id="" style="color:red; font-weight:bold;"></span>
n<span class="" id="" style="color:red; font-weight:bold;"></span>
d<span class="" id="" style="color:red; font-weight:bold;"></span>
 <span class="" id="" style="color:red; font-weight:bold;"></span>
b<span class="" id="" style="color:red; font-weight:bold;"></span>
u<span class="" id="" style="color:red; font-weight:bold;"></span>
Reply With Quote