[thelist] Splitting Article into Multiple Pages

Boris Mann boris at bmannconsulting.com
Thu Feb 20 08:22:33 CST 2003


On Thursday, February 20, 2003, at 09:07 AM, Alan McCoy wrote:

> Greetings!
>
> I have a MySQL database of essays that contain some pretty long
> articles.
> I'm using PHP and instead of throwing all the text up on one mile-long
> page,
> I'd like to be able to automagically break up the article among
> multiple
> pages. (...and NOT for the purpose of creating more ad space to sell!
> ;-)

If you already have a bunch of long articles, you can perhaps split on
a number of characters, then scan forward for the next bit of
whitespace/a period.

> I had thought about using multiple text areas for breaking up the
> story when
> it is published, but fear it may be a bit cumbersome for the writers.
> They
> might be able to handle putting in a tag (like <pagebreak>) to signify
> page
> breaks in the text if it's possible that PHP could spot the tags and
> split
> it into separate pages accordingly.

I think this would work nicely. Instead of a tag like <pagebreak>, make
it an HTML comment like <!-- pagebreak -->. That way, you can also have
a "click here for print version" that makes it all one page suitable
for printing. You can even just output the HTML comment, since it won't
display at all.

To make it easier on your users, you could add a button at the top of
the textarea that, when clicked, inserts the tag for them.

HTH -- no code or pointers, just ideas this morning :)

--
Boris Mann
http://www.bmannconsulting.com




More information about the thelist mailing list