Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

*NOT* escaping a Global return

Quote Reply
*NOT* escaping a Global return
Hi:

I was going to put in a global "<%ad_top%>" that is a perl call to my ad management program. The global is:

sub {

use LWP::Simple;

my $html = get("http://www.mysite.com/banners.fpl?region=7&mode=SSI&keyword=NULL");

$html ||= "[an error occurred processing this request]";

return $html;

}

Only the code returned is escaped- that is, a "<" is &lt;, etc. So rather than printing the code out, it is all escaped and prints literally. What do I do to fix this?


dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] *NOT* escaping a Global return In reply to
You tried html_unescape?

Code:
sub {

use LWP::Simple;

my $html = get("http://www.mysite.com/banners.fpl?region=7&mode=SSI&keyword=NULL");

$html ||= "[an error occurred processing this request]";

$html = html_unescape($html);

return $html;

}

You may need to use something like;

$html = GT::CGI::html_unescape($html);

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] *NOT* escaping a Global return In reply to
Andy:

Thanks! I knew there was some method of doing this, I just did not know how!

Thank you!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] *NOT* escaping a Global return In reply to
Andy:

Hmmm... the first caused an error... so I went to the second method... that worked (did not crash Forum) but it did NOT unescape the characters...

dave
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] *NOT* escaping a Global return In reply to
Code:
sub {
require LWP::Simple;
my $html = LWP::Simple::get("http://www.mysite.com/banners.fpl?region=7&mode=SSI&keyword=NULL");

return $html ? $IN->html_unescape($html) : q{[an error occured processing this request]};
}
Quote Reply
Re: [Paul] *NOT* escaping a Global return In reply to
Paul:

Thanks!

Tried it- still did not escape it....

I wonder if it is a problem with the output of the other program- I am using the perl output of the AdvertPro program....
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] *NOT* escaping a Global return In reply to
OK, Figured it out.

Do NOT escape the global.... escape the CALL to the global...

So, for the above script, suppose it is called ad_top

In the templete, just put <%unescape_html ad_top%>

easy!
dave

Big Cartoon DataBase
Big Comic Book DataBase