Archive for September, 2008
How to convert a text URL into a hyperlink
May sound easy, change the HTML….
but there are time when you cannot directly change the HTML. For instance if your content is database driven, and you don’t want to edit the database source.
well, a little PHP code can do the trick
$str = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $str);
for example This will take a a http://www.attheboard.com and change it […]
Posted: September 14th, 2008 under PHP.
Comments: none