Break lines which are too long without gaps
I've made sort of a forum with PHP/MySQL and almost everything is ok except for the fact that when a user enters a long line without spaces, it's viewed without line breaks and it causes to break the layout of the table the data is arranged with.
I've thought that I might use the function nl2br(), but I'm not sure how to do it (before entering data on the DB, or afterwards on the output), or if there's no need to do it because there's something else better, for instance some CSS property.
Any help on thie please?
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
You could use wordwrap() with the optional 4th parameter set to true.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Thanks a lot for your help!
I have another little problem regarding this issue and I need your help again:
I finally opted for using wordwrap, and I assigned a limit of characters so that too long lines without spaces were cut.
But another issue comes up:
As the characters have different widths, 100 sequential m's on a line would be much longer than 100 i's. Thus, the limit of characters will always be either too short if there are many narrow characters with quite a long limit or too long if there are many wide characters with quite a short limit, showing either too short containing cells or overflown cells respectively.
Another suggestion to get around this?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread