Jump to content

paginate an article into multiple pages


pickachu

Recommended Posts

I believe on some websites they use a special tag like:

 

=== BREAK ===

 

or something .. in which case you could explode the text by "=== BREAK ===" then have say "?page=2" in the URL and return the text at that index of the array. So something like:

 

// assuming $article contains the text

$page = (!$_GET['page']) 0 : (int) $_GET['page'] - 1;

$article_pages = explode("=== BREAK ===", $article);

echo $article_pages[$page];

 

.. not tested but it's just a quick idea.

 

Adam

 

No not really...you did say you want it to break at specific spots... If you were wanting it to break every 100 words or something, or every x paragraph tag, etc..then sure.  The key is that you have to establish a pattern.  If there's no pattern, then you have to use something as a marker, like a [pagebreak] tag. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.