View Single Post
Old 07-06-2006, 09:36 PM   #8 (permalink)
helloworld
Contributing Member
 
helloworld's Avatar
 
Join Date: 06-29-06
Posts: 70
iTrader: 0 / 0%
Latest Blog:
None

helloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebody
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

Last edited by helloworld; 07-06-2006 at 09:42 PM..
helloworld is offline   Reply With Quote