Dan's Orbiter page

Orbiter English => Orbiter English => Topic started by: DanSteph on 18 March 2003, 20:30:59

Title: FORUM URL: working on it
Post by: DanSteph on 18 March 2003, 20:30:59
As a lot of people forget the [] url tag I try to add an automatic
converter so you can click on them even without adding the tag...
It seem to work well but there is still some small error , mainly with
the url correctly "tagged"  (there is an "[url.]" text at the end

Sorry for that I'm working on it.

Dan
Title: Re: FORUM URL: working on it
Post by: DanSteph on 18 March 2003, 20:35:15
example:

no tag, just link: www.dansteph.com   work well
with tag still error http://www.dansteph.com
Title: Re: FORUM URL: working on it
Post by: DanSteph on 18 March 2003, 22:12:25
BINGO !

no need anymore for url tag, (but you can use them if you want)

You welcome :)

Dan
Title: Re: FORUM URL: working on it
Post by: DanSteph on 18 March 2003, 22:38:03
CRAP !

It broke the (img) tag I'll fix it tomorrow.

Dan
Title: Re: FORUM URL: working on it
Post by: reekamachaa on 19 March 2003, 02:41:23
Very Cool.
Since no-one's replied about this besides yerself...
THANKS VERY MUCH, Dan!  :)
Title: Re: FORUM URL: working on it
Post by: Pt on 19 March 2003, 14:58:50
Hehe fine!
Title: Re: FORUM URL: working on it
Post by: DanSteph on 19 March 2003, 19:56:15
is anyone good in php ? I'm brain fried and tired today...

I want to parse the url but not the one that have a tag before [//url] (url, img etc etc)
I don't know how to include a not "]" before http or www.

This routine work well but it translate also the url that have "img" tag before:

$body = preg_replace("/((http(s?):\/\/)|(www\.))([a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%]+)\b/i","href=\"http$3://$4$5\"target=\"_blank\">$2$4$5",$body);

Thanks for any help

Dan
Title: Re: FORUM URL: working on it
Post by: DanSteph on 21 March 2003, 16:59:18
DONE:


The solution was:


$body = preg_replace( '{(?:(?[.\s<>!:;,?])|(?!:;,?]))}
ie', "'$7' != ''? \"$7\" : \"target='_blank'>$1$2$3$4$5\"", $body);    



Now link are automatically converted in URL and image tag work also.
no need for ["url"] tag anymore

Dan