Creating Links in data output
| From: | Tonya | Date: | Fri, 17 Oct 2003 07:57:49 +0000 |
| Subject: | Creating Links in data output | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-31095@lists.php.net to get a copy of this message | ||
Hi :) I am new to PHP and new to this mailing list, so I hope I am not asking something that you
tire of answering :)
I am creating my first news posting application and I need a function to convert any URLS added to
the news message into links. I found this snippet:
function insert_links($newstext) {
$ret = eregi_replace( "([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",
"\\1://\\2\\3", $newstext);
$ret = eregi_replace( "(([a-z0-9_]|\-|\.)+@([^[:space:]]*)([[:alnum:]-]))",
"\\1", $ret);
return($ret);
}
I have added this snippet to my file, but it does not work - The string $newstext still does not
include links. I have tried to echo $ret, which returns nothing, and echo $newstext, which returns
my text message, but without links.
Does anyone have any other snippets that might work for this? Please be very 'layman' in
your response - I have only been working with PHP for a couple of weeks and this is my first
language to learn (other than HTML).
Thanks in advance!!
Summer