Quote:
|
Originally Posted by GoWFB_SEO
is there a code so that when I type http://www.domain.com, it will automatically become a link? (without using <a href>)
|
Code:
<?php
//check what?? could possibly use a $GET_['text'] to change a form //
$input = "http://www.yahoo.com is a great place to visit";
///change it///
$input = trim($input);
$input = htmlspecialchars($input);
$input = preg_replace('#(.*)\@(.*)\.(.*)#','<a href="mailto:\\1@\\2.\\3">Email</a>',$input);
$input = preg_replace('=([^\s]*)(www.)([^\s]*)=','<a href="http://\\2\\3" target=\'_new\'>\\2\\3</a>',$input);
//echo modified input//
echo "$input";
?>
This code will do
IE:
http://www.yahoo.com
www.yahoo.com
you@yahoo.com "converted to a mailto that says email"
what it will not do is,
http://yahoo.com
hope it helps, just didn't have much time today
