Page 1 of 1

word wrap without breaking HTML code

Posted: Mon May 08, 2006 9:42 pm
by jrucifer
I have a website that is updated by a group of users, and if they ever copy and paste a URL, it breaks the tables. I've tried using word wrap, but then it breaks any long html code. Logically, it seems like the best solution would be to exclude anything in the < > brackets from being wrapped, but I'm not skilled enough in PHP to put the code together. Any simple solutions? Thanks for any help.

Posted: Mon May 08, 2006 9:46 pm
by Todd_Z
sounds like a problem that regular expressions can fix. Using an expression, you can split the html code after a certain amount of characters and when a html tag is not open. Look into that for the solution. I would write it for you, as its an interesting regex, buuuuut I'm about to fall asleep at the keyboard.

Posted: Mon May 08, 2006 9:48 pm
by feyd
Why not automatically shorten the text used for the URL if it matches the URL? There are various methods to do this but which to use depends on how the URL is being handled by your script. Could you post a literal sample of what could be pasted?