Re: Splitting long text
| From: | Paul Novitski | Date: | Wed, 24 Jan 2007 07:40:45 +0000 |
| Subject: | Re: Splitting long text | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247683@lists.php.net to get a copy of this message | ||
At 1/23/2007 05:52 PM, Skip Evans wrote:
I have a requirement to take a large amount of text, a story submitted to a competition, and split into displayable chunks of 600 words each.At 1/23/2007 07:20 PM, Anas Mughal wrote:
// textwrap 1.1 Brian Moon <brian@phorum.org> // This code is part of the Phorum project <http://phorum.org>At 1/23/2007 10:40 PM, Travis Doherty wrote:// $String The string to be wrapped.// $breaksAt How many characters each line should be. // $breakStr What character should be used to cause a break.
Short of string padStr in that function, and bool cut in the native PHP one, I don't see why someone wouldn't just use http://php.net/wordwrap/ .Ouch! Inserting hard carriage returns into the markup can only work when a) the font size is fixed (which we know better than to attempt) or b) the column width enlarges with the font size in a completely zoomable page. If the number of characters per line is allowed to change, as happens when font size changes in a fixed column width, hard carriage returns will break the wrap. Far better to let the browser handle word-wrap. Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com