A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 3: Plug-in 10 - Shorten Text

Sometime, when you want to display the URL on a webpage it can be so long it looks untidy and messes up your layout. Of course you can come up with suitable text for a hyperlink instead showing the URL, but what about when a user posts a web address to your website? This plug-in has a simple solution because it shortens any long URLS (or other strings) by removing the middle and only keeping the two ends.

The Figure shows a long URL text string followed by a version shortened by this plug-in.