RE: [PHP] splitting content into pages
| From: | Chris W. Parker | Date: | Thu, 31 Jul 2003 02:19:42 +0000 |
| Subject: | RE: [PHP] splitting content into pages | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-157636@lists.php.net to get a copy of this message | ||
daniel@electroteque.org <mailto:daniel@electroteque.org>
on Wednesday, July 30, 2003 7:04 PM said:
> ok let me explain , its straight up text content from the database ,
> say its scrolls for ages , i need to split it into pages , so i get
> the length of the string up to the last paragraph which fits i need
> to split it there any idea ?
The primitive, basic way to do this is:
1. grab the entire document and explode it on " "
2. determine how many pages there are
3. display the first page (120 words)
4. on the next page start back at 1 except when you get to #3 go to #5
instead.
5. display the next 120 words by multiplying the page number by 120 and
continuing until pageNumber*120+120. For example, you're on page 2, and
your showing 120 words per page. That would be 2*120+120. Words shown on
page 2 are 240 through 360.
6. continue until all pages are done.
Make sense?
Chris.
p.s. No spaces come before punctuation in English. Sorry to dissapoint
you again.