I'm using the search highlighting plugin and I'm having a problem that is DRIVING ME CRAZY
If you put the following tag in the search results loop:
<%post_message%>
<%endif%>
as expected it will print out the entire post with the search terms highlighted for each record in the search results...
But if I try to shorten the post to 200 characters by running it throught the following global
my $p = shift;
return = substr($p,0,200);
}
as follows:
<%html_strip($post_message)%>
<%endif%>The post gets html escaped and all the html entities are returned as encoded: ie < for <, > for >, etc
NOTHING I do to unescape the string seems to effect it! For example:
my $p = shift;
$p = substr($p,0,200);
return GT::CGI::html_unescape($p);
}
I've tried regex:
my $p = shift;
$p = substr($p,0,200);
# convert < and > to < and >
$p =~ s/>/>/g;
$p =~ s/</</g;
return $p;
}Even just passing through the variable html escapes the string:
my $p = shift;
return $p;
}
So there must be something going on in the global parsing behind the scenes...
ps. I've also tried HTML::Entities.
GT? Anybody? Help? There must be a solution...

If you put the following tag in the search results loop:
Code:
<%if post_message%> <%post_message%>
<%endif%>
as expected it will print out the entire post with the search terms highlighted for each record in the search results...
But if I try to shorten the post to 200 characters by running it throught the following global
Code:
sub { my $p = shift;
return = substr($p,0,200);
}
as follows:
Code:
<%if post_message%> <%html_strip($post_message)%>
<%endif%>
NOTHING I do to unescape the string seems to effect it! For example:
Code:
sub { my $p = shift;
$p = substr($p,0,200);
return GT::CGI::html_unescape($p);
}
I've tried regex:
Code:
sub { my $p = shift;
$p = substr($p,0,200);
# convert < and > to < and >
$p =~ s/>/>/g;
$p =~ s/</</g;
return $p;
}
Code:
sub { my $p = shift;
return $p;
}
So there must be something going on in the global parsing behind the scenes...
ps. I've also tried HTML::Entities.
GT? Anybody? Help? There must be a solution...