SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Houston
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    preformatted text in a table help!!!

    I want to display a body of text in a table cell using preformatted text that is pulled from an SQL databse. I want to use preformatted so I can retain returns and indentions in the article, but I have found that the table resizes and runs the text as long as it so chooses. Is there a way to "lock" the table size so that it does not allow the text to resize it but rather automatically breaks the text where neceassary to maintain the table size? Of course I can format the text as "none" or "paragraph" but then I loose the paragraph breaks and spacing form the original submisison. Any help would be appreciated, thanks.

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since you are working with a database already, why don't you just read in the information from the input form and do a string replace on it to add in <br> tags?

    PHP has built in functions for doing just that:

    str_replace:
    http://www.php.net/manual/en/function.str-replace.php

    htmlspecialchars()
    http://www.php.net/manual/en/functio...ecialchars.php

    and more. Here is the master list for strings manipulation functions:
    http://www.php.net/manual/en/ref.strings.php

    That would be more efficient and easier for you, not to mention your TABLE would look better.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Houston
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved! It's quite simple actually. The text in question is submitted via a form. FOr the textarea used in the form, you must specify WRAP="HARD". The form then adds a hard return at the end of each line, which is specified by the dimensions of the form textarea box itself. Thanks for you suggestions.


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
  •