PDA

View Full Version : wrapping Text



Liquid-Fire
19 Dec 2005, 06:54 AM
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?

Rincewind
19 Dec 2005, 09:24 AM
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.