Pagination for HTML articles (not items)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
josh4
Forum Newbie
Posts: 2
Joined: Wed Aug 11, 2004 9:39 am

Pagination for HTML articles (not items)

Post by josh4 »

I'm having trouble trying to figure out how to use pagination in a certain way. I understand the method if you are running a query or listing specific items in a database. What I don't understand is how you generate pagination when all you have is a single HTML file that you want to split up into separate pages.

So far when I look for answers on pagination all I can find is stuff related to LIMIT statement and using offsets.

Say the book war and peace was typed out into a single HTML page. How would I use PHP and MySQL to separate that HTML file into multiple pages?

I've thought about including page tags, such as having
{PAGE 1}
blah blah blah blah blah
{PAGE 2}
blah blah blah blah blah

But this would require the tags to be manually entered and edited in the pages. It'd be much more helpful if I had a way for a single script to separate the pages entirely on its own. So warandpeace.html could just be uploaded onto the server and when it is accessed the pages are automatically generated.

help? please?
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Not directly an answer but a question for you...

How would you determine what a page is ? Bear in mind that different monitors show different amounts of infomation. Any methodology would need some way of determining the "separator" be it x lines or whatever. Then what about trying to keep paragraphs on the same page (window/orphans in Desktop Publishing terminology). Is this a proportional or fixed width font?
There are a few of many questions to answer.

Rather than have a one page HTML file you could have a piece of code which scans through your book to split it into smaller HTML chunks. The algorithms used for when to split would need to be defined. Then each of these chunks would be linked to each other. This is prior to the user accessing your site as it is too time consuming to perform it each time.
Post Reply