Ver Mensaje Individual
  #7 (permalink)  
Antiguo 31/01/2015, 17:18
apustilnik
 
Fecha de Ingreso: septiembre-2009
Mensajes: 402
Antigüedad: 14 años, 7 meses
Puntos: 6
Respuesta: Funcion para crear hipervinculos

excelente!! igual lo había resuelto de la siguiente forma, que probe y funciona también:

function url($texto){

$patron = '/(https?:\/\/)?([a-z]+\.[a-z\d\-_]+\.[a-z\d]{2,6}(\.[a-z\d]{2,6})?([a-z\d\-_\/]+)?)/is';

return preg_replace($patron, '<a href = "http://$2" target=_blank>$2</a>', $texto);

}

$width= 60;
$break= "<br />\n";
$cut= true;

$a= "hola visita http://hotmail.com muchas gracias";


// le agregue un str_replace substituyendo ese pedacito de texto y funciona
echo url(wordwrap(str_replace("http://", "http://www.", $a), $width, $break, $cut));

mil gracias por tu ayuda y tu paciencia
a tus ordenes, saludos cordiales.
ariel