/ Published in: PHP

Does not require http in the text to link. It must start with www however. Optionaly make the links popup in a new window.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * AutoLinkUrls() * * @param mixed $str * @param bool $popup * @return void */ function AutoLinkUrls($str,$popup = FALSE){ $pop = ($popup == TRUE) ? " target=\"_blank\" " : ""; $period = ''; $period = '.'; } $matches['1'][$i].'<a href="http'. $matches['4'][$i].'://'. $matches['5'][$i]. $matches['6'][$i].'"'.$pop.'>http'. $matches['4'][$i].'://'. $matches['5'][$i]. $matches['6'][$i].'</a>'. $period, $str); }//end for }//end if return $str; }//end AutoLinkUrls
Comments
