Ben bir metin parçası üzerinde arama anahtar kelimeleri vurgulamak için bu sınıf kullanıyorum:
class highlight
{
public $output_text;
function __construct($text, $words)
{
$split_words = explode( " " , $words );
foreach ($split_words as $word)
{
$text = preg_replace("|($word)|Ui" ,
"<font style=\"background-color:yellow;\"><b>$1</b></font>" , $text );
}
$this->output_text = $text;
}
}
If
$text = "Khalil, M., Paas, F., Johnson, T.E., Su, Y.K., and Payer, A.F. (2008.) Effects of Instructional Strategies Using Cross Sections on the Recognition of Anatomical Structures in Correlated CT and MR Images. <i>Anatomical Sciences Education, 1(2)</i>, 75-83 "
Zaten HTML etiketleri içeren ve benim arama bazı anahtar kelimeler hangi
$ Kelime = "Efektler renk"
Ilk göz <font style="background-color:yellow"> Etkisi </font> ile, kelime Etkileri vurgular, ancak ikinci döngü HTML etiketi kelime rengi vurgular. Ben ne yapmalıyım?
O zaman yalnızca metni vurgulamak için preg_replace söylemek mümkün mü onun değil bir timsah dirsek iç?