Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Parsing Display Email field as HTML

Quote Reply
Parsing Display Email field as HTML
Heya all,

I'd like to parse the Display Email field like normal HTML when I show it in a user's profile. Reason for this is that I'd like for my users to post their email addresses as Character Entities to make it harder for robots to harvest and cut down on spam.

Here's my email address:
sangiro@dropzone.com

At this stage if I enter the entities they show up as such on the screen. When I enter them on a normal HTML page it obviously works. Any help?

PS - Here's a nice encoder for those of you who want to use this on your site. Smile

Safe swoops
Sangiro

Last edited by:

sangiro: Apr 24, 2004, 1:03 PM
Quote Reply
Re: [sangiro] Parsing Display Email field as HTML In reply to
Text is always HTML escaped to prevent any XSS vulnerabilities. Instead, you'll probably want your users to post their email addresses normally and write a global (or modify the code - depends on where you want this done), to do the translation.

Adrian
Quote Reply
Re: [brewt] Parsing Display Email field as HTML In reply to
I wrote a global to do this, but I'm having the same problem. Is there any way to prevent gforum from HTML escaping the text in this limited context?

Here's the global:

sub {
use HTML::Entities();
return HTML::Entities::encode_entities(shift);
}

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Parsing Display Email field as HTML In reply to
Try this;

Code:
sub {
use HTML::Entities();
my $back = HTML::Entities::encode_entities(shift);
return \$back;
}

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: May 12, 2004, 10:19 AM
Quote Reply
Re: [Andy] Parsing Display Email field as HTML In reply to
Thanks Andy. Seems to work perfectly.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Parsing Display Email field as HTML In reply to
How do you call your global in your templates?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Parsing Display Email field as HTML In reply to
<%global_name($field_name)%>

...should do the trick :)

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] Parsing Display Email field as HTML In reply to
I actually tried that with no luck.. which is why I asked. Not sure if it was my tag call or the global that wasn't working. It still outputs exactly what I have in the database field to the HTML.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Parsing Display Email field as HTML In reply to
What if you change "shift" to "$_[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] Parsing Display Email field as HTML In reply to
Code:
sub {
use HTML::Entities();
my $back = HTML::Entities::encode_entities($_[0]);
return \$back;
}

No joy... Frown

Still posts the actual data.

Safe swoops
Sangiro

Last edited by:

sangiro: Jun 26, 2004, 7:27 AM
Quote Reply
Re: [sangiro] Parsing Display Email field as HTML In reply to
I've just been trying it on my server too, and it won't work :( I guess my global (in the other thread) will have to do.

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] Parsing Display Email field as HTML In reply to
I'd like to hear from hennagaijin on how he calls this global. There are some limitations on the other global that I think this one will work around. Smile

Safe swoops
Sangiro