Gossamer Forum
Quote Reply
clean description
Is there global that I can use that take the Description and clean it form all html code. I mean if in the Description there are <br><BR> <href></a> <b><u> and more it will not display this code or it change this to &lt; and &gt;.
Quote Reply
Re: [nir] clean description In reply to
Try something like this:

http://www.gossamer-threads.com/...%3F_P305257/#p305257

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] clean description In reply to
Thanks
Quote Reply
Re: [Andy] clean description In reply to
I notice that it not delete <a href= and </a> Shocked
Quote Reply
Re: [nir] clean description In reply to
Try this global:

Code:
sub {
use HTML::Parse;
use HTML::FormatText;
my $plain_text = HTML::FormatText->new->format(parse_html($_[0]));
return $plain_text;
}

This will require you to have the modules HTML::Parse and HTML::FormatText installed (if they are not, your host should be able to do it easily for you)

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!

Last edited by:

Andy: Apr 20, 2009, 8:33 AM
Quote Reply
Re: [Andy] clean description In reply to
Thanks,Smile
I still get the <p> and </p>, is there anything that I can do?
Quote Reply
Re: [nir] clean description In reply to
Sorry, forgot to add:

Code:
return $plain_text;

..after:

Code:
my $plain_text = HTML::FormatText->new->format(parse_html($_[0]));

...not sure if you added that in? (otherwise it shouldn't have worked =))

If those <p>< tags are still being a problem, just try adding this...

Code:
$plain_text =~ s/\Q<p>//sig;
$plain_text =~ s/\Q<\/p>//sig;

... after:

Code:
my $plain_text = HTML::FormatText->new->format(parse_html($_[0]));

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] clean description In reply to
Code:
$plain_text =~ s|</?p>||sig;

Crazy