Hi,
I want to hightlight those word that match with the user specify search term for my search result.
//CCGetParam function will retrieve the value from URL parameter.
if (CCGetParam("s_keyword") != "" ) {
$string_to_split = CCGetParam("s_keyword");
$tok = split(" ", $string_to_split);
$size = sizeof($tok);
for ($i = 0; $i < $size; $i++) {
//Example of changing all matching keywords to a red font.
$ticket_result->ticket_desc->SetValue(str_replace($tok[$i], "<font color = red>". $tok[$i] ."</font>", $ticket_result->ticket_desc->GetValue()));
}
}
However I have noticed this doesn't work well as it is case senstive. For example
if the user key in "cpu threshold" in the search term.
When the result was returned, for example "PROBLEM CPU utilization exceeds configured threshold" only "threshold" was highlighted. Unless the user key in "CPU threshold", then "CPU" and "threshold" will be highlighted.
Apart from this issue, if the user key in the following string in the search box.
PROBLEM abc syslog: CVSDM; minor WARNING Event Code=265; One or more disks .
The hightlight totally not working at all. it will return
or = red>PROBLEM or = red>syslog: or = red>syslog: or = red>CVSDM; MAJOR warning or = red>Event Code=204; or = red>One or more disks have failed.; ; Hardware Address=0/