View Full Version : table width... can stretch...
pjrey
11-10-2005, 11:09 PM
if i type one long string of text, with no spaces... it will cause my table to stretch... i have it set to 560 width.. why doesnt it force a break when it reaches that point? if i type EEEEEEEEEEEEEEEEEEEE (times 10) it will cause my table to be stretched wayyyy wider than 560.
i know this is kinda a dumb question..
but how do i get it so this could never happen....
does it makes sense? http://asia.pjrey.com
thanks
pj
mwinter
11-11-2005, 07:13 PM
if i type one long string of text, with no spaces [...] why doesnt it force a break [...]?Line breaks can only occur with white space.
The best solution is to either reject text that contains more than, say, thirty characters or to forcably inject white space into long 'words'.
Mike
pjrey
11-12-2005, 12:51 AM
thanks... how would i go about doing eitehr of those two options?
p
pjrey
11-13-2005, 05:40 AM
anyone?? i found http://www.cs.tut.fi/~jkorpela/forms/textarea.html but i want it to limit a word with no spaces, not characters in general.. the post can be as long as need be, but a word can be no longer than 25 characters...
anyone have any ideas?
pj
mwinter
11-13-2005, 01:09 PM
Sorry, I forgot to follow-up yesterday.
Assuming you're using PHP to process the entries, you could use:
$text = preg_replace_callback('/[\\w\'-]{26,}/g',
create_function('$matches',
'return implode(\' \', str_split($matches[0], 25));'),
$text);
which would break up 'words'[1] that are 26 characters or longer using spaces.
If you want to just check for long words, then
if(preg_match('/[\\w\'-]{26,}/', $text)) {
/* Long words */
}
would accomplish that.
Mike
[1] In this case, a 'word' would be any sequence of characters that contains letters, numbers, underscores (_), hyphens (-), or apostrophes (').
pjrey
11-13-2005, 06:08 PM
i dont use php, im using shtml...
is there a way i can still use your code? (externally?)
thanks
p
mwinter
11-15-2005, 12:08 AM
i dont use php, im using shtml...As in SSI? Server-side includes?
Does that mean to say that only you are typing text into a file to have it displayed on the page?
is there a way i can still use your code? (externally?)No. You'd have to be using a programming language like PHP, ASP, Perl, etc. (and the code would have to be ported, obviously, for those other languages).
Mike
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.