Automatically shorten long hyperlinks
Posted: Tue Apr 29, 2008 8:33 pm
I've been googling for what I thought would be an easy thing to find.
I'm after a script/function/code to parse a body of text and automatically shorten any long hyperlinks within it.
In a new site of mine, a couple of users have posted URL's which are quite long and push out the size of the fixed width column breaking it.
So basically I'm want a shortenUrl($content) sort of function to shorten any URL longer than $length characters, as follows:
Cheers,
EoN
I'm after a script/function/code to parse a body of text and automatically shorten any long hyperlinks within it.
In a new site of mine, a couple of users have posted URL's which are quite long and push out the size of the fixed width column breaking it.
So basically I'm want a shortenUrl($content) sort of function to shorten any URL longer than $length characters, as follows:
to be passed through the function and return something like...This is a body of text here is a hyperlink http://www.aaa.com/bbb/ccc.php?ddd=fff yes goodbye
Anyone used, or know of something like this?This is a body of text here is a hyperlink <a href="http://www.aaa.com/bbb/ccc.php?ddd=fff" ... /bbb...</a> yes goodbye
Cheers,
EoN