PHP Classes

File: StoryPager.html

Recommend this page to a friend!
  Classes of Steven Haryanto   StoryPager   StoryPager.html   Download  
File: StoryPager.html
Role: ???
Content type: text/plain
Description: documentation
Class: StoryPager
Author: By
Last change:
Date: 23 years ago
Size: 1,780 bytes
 

Contents

Class file image Download
<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 &lt;table&gt;'s or &lt;pre&gt;'s or &lt;p&gt;'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 &lt;script&gt; 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>&lt;!--&nbsp;NOBREAK&nbsp;--&gt;</code> in the text), or to page the text manually (right where the string <code>&lt;!--&nbsp;BREAK&nbsp;--&gt;</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 &lt;p&gt; 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>