You are here: Re: split an article over several pages « PHP SQL « IT news, forums, messages
Re: split an article over several pages

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация