Results 1 to 2 of 2

Thread: wrapping Text

  1. #1
    Join Date
    Dec 2005
    Posts
    7

    wrapping Text

    Ok I am not sure if this is m,ysql/php/css issue. I have a working php script that reads in the 30 newest news items form mysql database and print them on on the websites along with css for formatting. What I started to notice after add php and mysql is that if I write none stop test no white line like:

    hasdofajshadbjckbnawergkasnbdrkahgsdknbfckashgfaksygdrkjbrsadkhsvjhzxnbfvawkjsrgaksjdbnfknasbfkjshga dfkbv

    That test goes over the potion of space it should, it is like the text will not "wrap" if there is no space. is there a way a wrapping text even if there is no space?

  2. #2
    Join Date
    Mar 2004
    Location
    China
    Posts
    3,315
    In php there is the wordwrap() function http://uk.php.net/wordwrap e.g.

    <?php
    $text = "A very long woooooooooooord.";
    $newtext = wordwrap($text, 8, "\n", 1);

    echo "$newtext\n";
    ?>

    This example would display:

    A very
    long
    wooooooo
    ooooord.

    Course you'd probably change the "\n" into "</ br>" for html output.

Posting Permissions

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