very long url does not wrap and runs off page. makes everything too wide
mwu - August 30, 2006 - 19:00
I have very long url's that run off the page. They are making the entire body too wide so that everything scrolls off the screen.
I am using bluemarine and cck. But this is a problem in story.module as well.
I tried to read about this. There seem to be many complicated solutions involving writing custom php text wrap solutions.
But I think there must be a simple solution.
Please tell me about all the options, simple to complex! thank you.

htmlwrap module
Take a look at the htmlwrap module maybe?
http://drupal.org/node/24027
I haven't tested this module myself and don't know if it will correctly handle the visible URLs for you, but from the description it sounds like it should.
I know that the drupal site adds an ellipsis to the url text by default if it's too long:
http://not-a-real-url.com/a/lotsoftextinastring/123565456423424/2654645/...
=======================
Just another newbie.
XHTML Strict: it's the way to be.
=======================
html wrap
good idea. you have a good handle on modules. how did you know about this?
the description in admin says this:
Automatically breaks up long words to prevent word wrapping format problems. Will not break html formatting or URLs.
but the description on the project says this
This is a common problem on site with newbie or troll commenters who post ong urls, or nonsense words to destroy the site layout
the 2 seem to contradict. i'll try it and report back.
anyone else with ideas please post!
I was confused by that too
I was confused by that too at first. I think it means it won't break the url inside the tag, but it will change the url that's displayed. E.g.:
<a href="http://this-wont-be-changed.com/">http://this-might....</a>Guessing though. :)
=======================
Just another newbie.
XHTML Strict: it's the way to be.
=======================
URL Shortener
look at this :
http://smarturl.eu
works!
works for story and cck!
the good news is that it broke up a very long url for story.module
the poster would have to manually choose that format
for cck, for that field, you will have to choose "filtered text" instead of "plain text" to get the input formats option. (thanks to a thread by ramdak)
(I couldn't do multiple select on input formats. I thought it was possbile, but I don't need it at the moment.)
I'm using urlfilter module
I'm using urlfilter module and satisfied with it so far. It does two things:
1) Makes URLs clickable links
2) Trunkates URLs longer than a certain number of symbols that you can define yourself in the settings.
http://drupal.org/project/urlfilter
thank you
thank you Natalie. I've used urlfilter before but never knew about the setting. you dug that up pretty well, because it's not in the documentation anywhere.
Yes, it's a recent addon and
Yes, it's a recent addon and hasn't been documented yet. I suppose we should remind the author or just add a comment in the documentation section.
htmlwrap vs urlfilter
ok urlfilter also works.
urlfilter is by steven wittens (just about the second most experienced developer after dries)
htmlwrap is by aaron welch, who does the airamerica radio site. so both are top drupal developers and both modules should be pretty bug-free.
they are different.
1) urlfilter let's you truncate after a default value. (I typed in a value, not sure if it was saved, because the default value continues to show in the box. Have not looked in phpmyadmin.)
the link is now the first half of the url. if a user does ignorantly clicks on the broken half link, the user will be lead to the wrong place.
however, the poster does not need to do anything special.
I didn't want clickable url's for security reasons. I want the user to think a little before they just click a link that could lead to a malicious site.
2) htmlwrap. the url is not clickable. user might realize they need to copy and paste the entire thing.
drawback is poster has to manually choose the format.
anyone up for patch htmlwrap so that admin can set it as on for a long "url field" in cck?
if anyone else knows about other modules, please post!
ways of handling the problem
Well, if you want the long urls to be shortened or wrapped, but do not want them to be clickable, that requires a somewhat more specialized solution. Here's a few ways I could think of for handling the problem:
<a href="http://really-long-stuff../index.html">http://shortened...</a>And:
My personal advice is that clickable URLs are much better for usability, but the text box idea seems like a good second choice if you really don't want URLs clickable. Of course this would probably also require some custom development (like a new filter).
I guess the next question is, which of these options for the user interface would work best for you?
=======================
Just another newbie.
XHTML Strict: it's the way to be.
=======================
Feature request: HTML Source Formatting in TinyMCE
What about using CSS
You could add a
overflow: hiddenstyle in your style sheet to the elements that contain the text you want to wrap. I have done this with my sidebar and content classes. This article is also useful - http://www.positioniseverything.net/explorer/expandingboxbug.html The urls are not clickable, but for blocks that show recent comments, it doesn't really matter. This method would have a very minimal performance impact.Why not use url-shrinker
Download desktop software from http://www.url-shrinker.com and shorten any url anytime. They last forever.
A quick and easy solution
A quick and easy solution for you might be use a web-based url shortener like:
http://littlurl.com