auc_ipaq
|
Posted: 06/12/2003, 2:02 AM |
|
I want to highlight the keyword in my search result I tried to modify the
example of CC but it doesn't work but the page doesn't show any error. This
is what I did.
My search include three field how am I going to do the highlight
before built select I put in the following code
global $ipaddress;
if (CCgetParam("keyword") != "")
{
$string_to_split = CCgetParam("keyword");
$tok = split(" ", $string_to_split);
$size = sizeof($tok);
for ($i = 0; $i< $size; $i++)
{
if (($i == 0) && ($i == $size-1))
$ipaddress->Where .= " and i.keyword like '%".$tok[$i]."%'";
elseif ($i == 0)
$ipaddress->Where .= " and (i.keyword like '%".$tok[$i]."%'";
elseif ($i == $size-1)
$ipaddress->Where .= " or i.keyword like '%".$tok[$i]."%')";
else
$ipaddress->Where .= " or i.keyword like '%".$tok[$i]."%'";
}
}
before show row I put the following code
global $ipaddress;
if (CCgetParam("keyword") != "" )
{
$string_to_split = CCgetParam("keyword");
$tok = split(" ", $string_to_split);
$size = sizeof($tok);
for ($i = 0; $i < $size; $i++)
$fldkeyword = str_replace($tok[$i], "<font color = red>". $tok[$i]
.."</font>", $fldkeyword);
$ipaddress->internal_ip1->Value=$fldkeyword;
}
|
|
|
DonB
|
Posted: 06/12/2003, 5:00 AM |
|
Have you verified that "keyword" is actually being split into the $tok
array? If that is working, then I would investigate the possibility your
font color is being ignored because of the stylesheet behavior overriding
it. One way to deal with that is to create your own highlight_class with
just the color attribute and change the code to be <FONT
class=highlight_class>. I like to do this by creating my own, separate,
stylesheet. Then I link it in from the HTML part of the CCS designer. This
was I avoid editing the standard stylesheet, and avoid the situation where I
change styles and have my cutom changes wiped out.
It may be a simple coding-syntax error, but I don't see it.
DonB
"auc_ipaq" <auc_ipaq@yahoo.com.sg> wrote in message
news:bc9fjv$ep0$1@news.codecharge.com...
> I want to highlight the keyword in my search result I tried to modify the
> example of CC but it doesn't work but the page doesn't show any error.
This
> is what I did.
>
> My search include three field how am I going to do the highlight
>
> before built select I put in the following code
>
> global $ipaddress;
> if (CCgetParam("keyword") != "")
> {
> $string_to_split = CCgetParam("keyword");
> $tok = split(" ", $string_to_split);
> $size = sizeof($tok);
> for ($i = 0; $i< $size; $i++)
> {
> if (($i == 0) && ($i == $size-1))
> $ipaddress->Where .= " and i.keyword like '%".$tok[$i]."%'";
> elseif ($i == 0)
> $ipaddress->Where .= " and (i.keyword like '%".$tok[$i]."%'";
> elseif ($i == $size-1)
> $ipaddress->Where .= " or i.keyword like '%".$tok[$i]."%')";
> else
> $ipaddress->Where .= " or i.keyword like '%".$tok[$i]."%'";
> }
> }
>
> before show row I put the following code
>
> global $ipaddress;
> if (CCgetParam("keyword") != "" )
> {
> $string_to_split = CCgetParam("keyword");
> $tok = split(" ", $string_to_split);
> $size = sizeof($tok);
> for ($i = 0; $i < $size; $i++)
> $fldkeyword = str_replace($tok[$i], "<font color = red>". $tok[$i]
> ."</font>", $fldkeyword);
> $ipaddress->internal_ip1->Value=$fldkeyword;
> }
>
>
|
|
|
|