Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/01/2008, 12:59
Avatar de hgp147
hgp147
 
Fecha de Ingreso: diciembre-2006
Ubicación: Buenos Aires, Argentina
Mensajes: 980
Antigüedad: 17 años, 3 meses
Puntos: 36
Re: ¿Cómo crear esta función?

SOLUCIONADO:

Código PHP:
<?

function inv_make_clickable($text

   
$ret ' ' $text
   
$ret preg_replace("#(^|[\n ])<a href=\"([\w]+?://[^ \"\n\r\t<]*)\" target=\"_blank\">([\w]+?://[^ \"\n\r\t<]*)</a>#is""\\1\\2"$ret); 
   
$ret preg_replace("#(^|[\n ])<a href=\"http://((www|ftp)\.[^ \"\t\n\r<]*)\" target=\"_blank\">((www|ftp)\.[^ \"\t\n\r<]*)</a>#is""\\1\\2"$ret); 
   
$ret preg_replace("#(^|[\n ])<a href=\"mailto:([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)\">([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)</a>#i""\\1\\2@\\3"$ret); 
   
$ret substr($ret1); 
   return(
$ret);
   
}  


echo 
inv_make_clickable("Texto <a href=\"http://forosdelweb.com\" target=\"_blank\">http://forosdelweb.com</a> texto");  

?>

Última edición por hgp147; 16/01/2008 a las 15:30