<h1>StoryPager</h1>
<p>A simple PHP class to automatically page a long HTML story/article. Such
algorithm is used at <a href="http://satunet.com">Satunet</a>. For example,
see <a
href="http://satunet.com/artikel/isi/00/10/27/31498.html?print=1">this</a>
page, which is automatically paged and becomes <a
href="http://satunet.com/artikel/isi/00/10/27/31498.html">this</a>. Yum,
imagine the extra pageviews.</p>
<p>Get StoryPager <a
href="http://steven.haryan.to/php/StoryPager.tar.gz">here</a>.</p>
<p>The algorithm is quite simple and goes like this: try to split the long
text after the desired page length, but delay the split if we are still in
<table>'s or <pre>'s or <p>'s in order to avoid screwing
up tables (ouch!) or preformatted sections. Guaranteed, this is not perfect,
but it works well in most cases. You might want to add the avoidance of
breaking
<script> sections if you want, etc.</p>
<p>In addition to that, you can also tell the class to not page at all (by
inserting the string <code><!-- NOBREAK --></code> in the
text), or to page the text manually (right where the string
<code><!-- BREAK --></code> appears). For example, see <a
href="http://satunet.com/artikel/isi/00/09/16/26977.html?print=1">this</a>
page, which is automatically paged and becomes <a
href="http://satunet.com/artikel/isi/00/09/16/26977.html">this</a>. Peek the
HTML source code of the unpaged version.</p>
<p>For best results, separate each "paragraph" text with a <p> or at
least a blank line, because this allows StoryPager to separate it with other
chunk of text.</p>
<p>See an example of how to use the class <a
href="http://wholesomesoft.com/storypager-demo/">here</a>.</p>
|