automatic shortening of longs url (ie. "my very very...very long url")
| Project: | Urlfilter |
| Version: | 4.6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | incidentist |
| Status: | duplicate |
Jump to:
Would it be possible to add the ability to shorten the display of a long url?
vBulletin (among many other) does this so urls that are almost a silly length will get shortened down, i'm guessing forst and foremost in order to prevent them from messing up the layout (since they don't linebreak).
An example; This is how the url would look today using a google search as an example (ie in html [a href="myurl"]whatever you see here[/a], replaced lessthan & greaterthan entities with [&])
http://www.google.com/search?hl=en&ie=ISO-8859-1&q=I+guess+this+url+woul...
so it would perhaps shorten it to:
http://www.google.com/search?[...]Search or
http://www.google.com/search?...Search
or something similar at least (the "cut" point was just made up, I guess they could be anywhere really), I'm guessing that could be fairly easy to implement? I might manage to take a look at it later today, just wanted to check if this would be something people would like to have in this module?

#1
i'm needing to shorten the drupal admin urls for adding or editing content.
i need to keep the path the same depth as the view.
example-
node view:
http://sitename/drupal/?q=node/1
node edit:
http://sitename/drupal/?q=node/1/edit
node add:
http://sitename/drupal/?q=node/add/
I need to shorten the latter 2 so it does not have a new directory level but instead formatted to be same as the view node url style. It's screwing up my file inserts using htmlarea and i'de rather change the formating on drupals end instead of my htmlarea's plugin.
is this along the same lines as what you are referring to?
#2
#3
I'll take a look at this, for 4.5, because I'm working from a CivicSpace install. Should be a simple fix that can be easily put into 4.6/7 anyway.
#4
We need to itegrate this modle in the links bundle. please contact me (berkessels gmx net) for details. All outgoing urls must be ran trough a general hook, so that things like weblinks, can check for permissions, or can add them to a luist of moderataion, or can even track outgoing clicks.
#5
The statistics module trims URLs to 35 characters:
<?phpfunction _statistics_column_width($column, $width = 35) {
return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column);
}
?>
If a new function is introduced to shorten URLs then it should be used in this module too.
#6
I'd like to see this, too. (I bumped it to 4.6 now that the new CS is out. Hope that's alright!)
#7
What is the status on this? I sloppily did this on my site, but the line breaks were messed up. Essentially all I did was use the /e switch in preg_replace and send the new URL string to a function that shortens it if it is longer than a certain length.
i would REALLY like this feature. Long URLs are killing me.
#8
I know this one was first, but dup of http://drupal.org/node/37881