Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Stripping the html from description- I can use this Global?

Quote Reply
Stripping the html from description- I can use this Global?
I was searching the forums on how to do it. I found this:

http://www.gossamer-threads.com/...?post=282003#p282003

I can use the global posted by 'funny login'?

Because it was posted in 2005, so I don't know if this html banning is already included in latest versions.

thanks.
Quote Reply
Re: [hegu] Stripping the html from description- I can use this Global? In reply to
Should do - but you need to use this post (not the one you linked), as this already has it in global form, and with details on how to use;

http://www.gossamer-threads.com/...eld_P283603/#p283603

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] Stripping the html from description- I can use this Global? In reply to
Thanks Andy!

If I don't want any of the html tags, I can use like this?

Code:

...................

my $allowed = [ ];

..................
Quote Reply
Re: [hegu] Stripping the html from description- I can use this Global? In reply to
Nah, you can't use that method .

You could try something like this (untested)

New global: clean_html
Code:
sub {
my $content = $_[0];
$content =~ s/<.*?>//g;
return $content;
}

Then call with:

<%clean_html($Description)%>

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] Stripping the html from description- I can use this Global? In reply to
Where I have to keep this tag? which file?

Code:
<%clean_html($Description)%>

thanks.
Quote Reply
Re: [hegu] Stripping the html from description- I can use this Global? In reply to
Well, depends on how you wanna use it. I'm assuming you simply wanna make it so that descriptions that have HTML tags in, get it "removed" when shown in their category / detailed page? Or are you asking for a way to stop them submitting HTML full stop?

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] Stripping the html from description- I can use this Global? In reply to
While submitting links, I don't want them to enter html tags in description field, contact name etc fields. (some people might enter redirect code, a hack etc) THey should be stripped away before the data enters into the database.

thanks.
Quote Reply
Re: [hegu] Stripping the html from description- I can use this Global? In reply to
Well, you could do that via Javascript, or a custom plugin (that checks the values before adding to the database)

Both of these are pretty complex (well, not so much complex - but long winded), and I'm afraid I don't have any time to play around with that for ya, sorry.

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] Stripping the html from description- I can use this Global? In reply to
OK. I found a small javascript code snippet.

http://www.javascriptkit.com/...pt2/removehtml.shtml

It is working good. But if I enter html with both open and closed tags, it is removing them OK.

If I entered like - (incompletely closed/open tags)

<br, <p , /ul>

These are not removing.

How to remove these incomplete tags and any special characters? Any minor modifications to the above code?
Quote Reply
Re: [hegu] Stripping the html from description- I can use this Global? In reply to
Hi,

Not sure - guess it would need editing to cope with all kinds of tags (even unclosed), but you would be there forever and a day doing that (as there are an unlimited number of combinations really)

Personally, I'd be happy with what you've got ;)

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] Stripping the html from description- I can use this Global? In reply to
It was my mistake,
Tanks a lot,
Personally, I am happy with what you give me ;)

Quote Reply
Re: [nir] Stripping the html from description- I can use this Global? In reply to
NP - glad it worked Cool

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!