Jump to content

Recommended Posts

Hi, I'm currently designing/coding a website which uses PHP/MySQL. The site is going to be content heavy, and I plan to have the content to be retreived from a MySQL database (So the user of the site can search the site, order by certain criteria etc. Anyway...

 

So far it's going fine, but because some of the articles are going to be rather long, I'm a bit confused about how it's best to store this in a database. I want some articles to span over multiple pages, but my original design/idea had only one field for the content (Simply 'content'). I guess the worst case scenario would be creating more fields, such as contentpage1, contentpage2 etc...

 

I'm just wondering if there's a way in PHP to span the fields over multiple pages? Maybe even searching for a certain line in the cell (such as 'Continues on next page') and splitting it there.

 

Thanks  :)

As mentioned, pagination is what you're looking for. Here is a link to our own tutorial:

http://www.phpfreaks.com/tutorial/basic-pagination

 

You're gonna have to modify it a bit to suit your needs, because you're dealing with a large block of text instead of lots of rows.  Best way to go about it is to make "keywords" like [pagebreak] where you want the pagebreaks to be.  Or you can make pagebreaks based on how many words or lines per page.  That's entirely up to you.  But whatever you do, you'd add a counter into that to determine how many pages you have total and use that for the part of the script that has the page links.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.