|
Posted by Tyrone Slothrop on 08/27/05 18:09
On 27 Aug 2005 06:15:12 -0700, markinbrighton@gmail.com wrote:
>Hi
>
>I am working on a website to show creative writing which is similar, in
>many ways, to a blog.
>
>Some of the pieces of writing a quite long and need to be displayed
>over several pages, rather than a single page.
>
>I've set up the MySQL database so that the text of the writing is
>stored in a single field. However, I need to find some way of splitting
>them into section of (say) 500 words and then creating the pagination.
>
>Anyone got any clues about how I could do this?
>
>Cheers in advance
See:
http://www.php.net/manual/en/function.str-word-count.php
You will have to treat the entire string as an array and split on the
spaces (or sentences or paragraphs) and pass a variable to determine
which set to display (as in page2, page3) as a link to the next page.
You will have to run the query for each page, unless you want to write
to a temp file (not a good idea since the files need to be cleaned up
periodically).
There is also:
http://www.php.net/manual/en/function.str-split.php
if you don't care if a word is partially displayed.
Navigation:
[Reply to this message]
|