Re: [PHP] auto link?
Take a look at http://www.php.net/manual/en/function.ereg-replace.php There's a bit of sample code up there that may help... -bob -- Bob Scott Web / DB Developer http://www.covalent.netCovalent Technologies, Inc. On Mon, 16 Jul 1979, [EMAIL PROTECTED] wrote: > On Ray's advice I've given up on letting the users put html into my form. > But I would like any http:// type addresses they include to be turned into > hyper links: > > > > http://www.mysite.com>www.mysite.com > > is there a script or function some place I can use to do this? Or must I try > to write something of my own? > > > Susan > > > -- > [EMAIL PROTECTED] > http://futurebird.diaryland.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] auto link?
Here's a function I use on a text field.. function activateUrls( $s ) { $o = ''; while ($s != '') { $url = ''; $temp = split('://', $s, 2); if (count($temp)>1) { # '://' found; now extract schema $s = $temp[1]; $temp2 = split('[^[:alpha:]]', strrev($temp[0]), 2); $schema = strrev($temp2[0]); # this gets schema $o .= substr($temp[0], 0, strlen($temp[0])-strlen($schema)); if ($schema != '') { # this ensures a non-null schema $temp3 = split("[[:space:],'\"<>:]", $s, 2); $url = $schema . '://' . $temp3[0]; $ns = substr($s, strlen($temp3[0]),1) . $temp3[1]; if ($temp3[0] != '') { $o .= "$url"; } else { $o .= $url; } $s = $ns; } else { $o .= '://'; } } else { $o .= $s; $s = ''; } } // while return $o; } Hope this helps, Chad -----Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, July 16, 1979 4:01 PM To: [EMAIL PROTECTED] Subject: [PHP] auto link? On Ray's advice I've given up on letting the users put html into my form. But I would like any http:// type addresses they include to be turned into hyper links: http://www.mysite.com>www.mysite.com is there a script or function some place I can use to do this? Or must I try to write something of my own? Susan -- [EMAIL PROTECTED] http://futurebird.diaryland.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] auto link?
On Ray's advice I've given up on letting the users put html into my form. But I would like any http:// type addresses they include to be turned into hyper links: http://www.mysite.com>www.mysite.com is there a script or function some place I can use to do this? Or must I try to write something of my own? Susan -- [EMAIL PROTECTED] http://futurebird.diaryland.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]