Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Bizarre problem -- GT PLEASE HELP!!!

Quote Reply
Bizarre problem -- GT PLEASE HELP!!!
I'm using the search highlighting plugin and I'm having a problem that is DRIVING ME CRAZY Crazy

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%>
The post gets html escaped and all the html entities are returned as encoded: ie &lt; for <, &gt; for >, etc

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 &lt; and &gt; to < and >
$p =~ s/&gt;/>/g;
$p =~ s/&lt;/</g;
return $p;
}
Even just passing through the variable html escapes the string:

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...
Quote Reply
Re: [Swaylock] Bizarre problem -- GT PLEASE HELP!!! In reply to
What about:

return \$p;

This should prevent value from been escaped.


Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Bizarre problem -- GT PLEASE HELP!!! In reply to
Boris! I love you!! Laugh

Perl can be soooo frustrating sometimes but there is ALWAYS an answer.
Quote Reply
Re: [Swaylock] Bizarre problem -- GT PLEASE HELP!!! In reply to
Wink

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins