View Single Post
  #10 (permalink)  
Old 08-24-10, 06:55
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
PHP Code:
$Words $frow["descrizione"];
//lets assume your keywords are in an array called $KeyWords
foreach ($KeyWords as $KeyWord)
$Words str_replace($KeyWord,"<span class='bold'>".$KeyWord."</span>",$Words);

so descrizione contains the text you want to highlight anmd is copied to $Words
you have an array $KeyWords with each of the words you want to highlight
the foreach statement iterates through every element in the array
the $Words text is scanned for each occurance of a key word, where found it adds the 'span' tags, and then moves onto the next keyword untill the array is exhausted.
having done that you have a variable $words which can be treated/handled as you wish
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote