Results 1 to 7 of 7

Thread: table width... can stretch...

  1. #1
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default table width..stretch... HELP! dont want it to!

    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
    Last edited by pjrey; 11-11-2005 at 03:21 AM.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pjrey
    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

  3. #3
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks... how would i go about doing eitehr of those two options?

    p

  4. #4
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, I forgot to follow-up yesterday.

    Assuming you're using PHP to process the entries, you could use:

    PHP Code:
    $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

    PHP Code:
    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 (').

  6. #6
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i dont use php, im using shtml...
    is there a way i can still use your code? (externally?)

    thanks
    p

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pjrey
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •