Shortening a URL?
Posted: Wed Feb 23, 2005 11:32 pm
I did a search and couldn't find anything much...
Here is my code:
Now what that does is cut the URL off after 55 chars and puts a ... afterwards to show that its is longer...
However, if the URl has less then 55 chars its still puts the ... after it... is there anyway I can stop it from adding the ... if it is less then 55 chars?
What would eb even better would be to set it up like vbulletin does their links. E.g:
http://www.domain.com/folde...th/filename.php
Any ideas on how to do that?
Thanks
Here is my code:
Code: Select all
$urlsmall = substr($url, 0, "55")."...";However, if the URl has less then 55 chars its still puts the ... after it... is there anyway I can stop it from adding the ... if it is less then 55 chars?
What would eb even better would be to set it up like vbulletin does their links. E.g:
http://www.domain.com/folde...th/filename.php
Any ideas on how to do that?
Thanks