This project is read-only.

intert too many links

Jan 24, 2011 at 1:04 AM

I want to do this.

I add to many links. for example

and I want to this with only one clicks



How can I do that ?

Mar 3, 2011 at 11:19 AM
Edited Mar 3, 2011 at 11:22 AM

Do it in the php-parser ;) it's easier I think (at least for me :P)


//search for example [url=,de/]Google[/url]
$newtext = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/", "<a href=\"\\1\" target='_blank'>\\2</a>", $oldtext);
//search for [url]link[/url] or [URL]link[/URL] and replaced it t a normal link without any tags or BBcodes
$newtext = preg_replace("/\[url\]www.(.*)\[\/url\]/isU", "http://www.$1", $oldtext);
//this function you are looking for -> search for a normal Link and replaced it
$newtext = preg_replace('#(^|[^"=]{1})(http://|ftp://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm','\1<a href="\2\3">\2\3</a>\4',$oldtext);

You see actually you don't need this function in your WYSIWYG-Editor ;)