Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-03-31 18:38:59

bzx
Member
Registered: 2007-01-11
Posts: 15

automatic display of email addresses in the article

hello

I couldn’t find this anywhere either: is it possible to have all email addresses (which appear in the article body) converted automatically to a <txp:email /> link? for example in the article body i would write example@example.com and it would convert it to <txp:email email=“example@example.com” linktext=“example@example.com” />

It’s probably some plugin, but i can’t find that anywhere.. please help.

I would really appreciate your help – thank you in advance!
peace
tom

Offline

#2 2007-03-31 19:05:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: automatic display of email addresses in the article

This is not possible, and as far as I know there isn’t a plugin either. You can use Textile:

"someone@somewhere.com(mail me)":mailto:someone@somewhere.com

This will output this html:

<a href="mailto:someone@somewhere.com" title="mail me">someone@somewhere.com</a>

Offline

#3 2007-03-31 19:14:08

bzx
Member
Registered: 2007-01-11
Posts: 15

Re: automatic display of email addresses in the article

thank you Els
yes I was aware of the standard link method – but was rather looking for more automated way.

anyway, thanks for your reply

Offline

#4 2007-03-31 20:31:14

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: automatic display of email addresses in the article

You can try this, I had asked akoksis at one point, if he’d be willing to write in a “post into the body” kind of javascript. I don’t think it’d be too hard, it could probably be copied over from the js in upm_img_popper. EDIT, It looks like akoksis, added this in v.2 :)

:) Hope that helps.

Matthew

Last edited by ma_smith (2007-03-31 20:41:32)


Offline

#5 2007-03-31 20:47:59

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: automatic display of email addresses in the article

This doesn’t seem hard – something with str_replace I guess. Textpattern uses the following function to convert email addresses:

function eE($txt) // convert email address into unicode entities
{
         for ($i=0;$i<strlen($txt);$i++) {
	              $ent[] = "&#".ord(substr($txt,$i,1)).";";
	         }
	         if (!empty($ent)) return join('',$ent);
}

…but I don’t know how to make eE grab all the email addresses.

Last edited by jm (2007-03-31 20:49:08)

Offline

#6 2007-03-31 20:48:09

bzx
Member
Registered: 2007-01-11
Posts: 15

Re: automatic display of email addresses in the article

hey man thanks a lot – that definetely helps !
it’s gonna be easier for the client who is not too much computer-literate.. and it would be very hard to explain him how to build that tag :)

thanks thanks !

Offline

#7 2007-03-31 21:25:43

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: automatic display of email addresses in the article

jm, that could be a tight little ditty. I’ll be following what happens here.
Itd be nice to have something like that act as a wrapping tag?


Offline

Board footer

Powered by FluxBB