Pagination is plugin for Movable Type that enables you to paginate lists of entries. For example, at the bottom of your home page, you could add a "Next" link so your readers can go to "Page 2" and read previous entries. You can display a list of linked page numbers to enable visitors to jump to any page number they want.
With Pagination Pro, you can also paginate your Category, Author, and date-based archives, and even paginate your Entry archives, displaying only a small number of comments on each page. New in version 1.5: You can also paginate long entries by splitting them up into multiple pages.
New Features in Pagination 1.5
- Support for MT 4.2 (minor bug fixes that may affect some sites running MT 4.2+)
- New template tags for next / previous page numbers
- Split long entries into multiple pages by easily inserting page breaks (Pro only)
Try it Now - Live Demo
The MT4 Test Blog has the Pagination Pro plugin enabled. Scroll to the bottom of the home page to see the list of pages and follow the links. Also take a look at an example of a paginated Category archive here. Finally, take a look at a paginated version of a 300+ comment entry here.
New: Paginated Entry Example - ReadWriteWeb
The latest version of the Pagination plugin is used by the popular technology blog ReadWriteWeb. (Disclosure: I provide consulting services to RWW) In additional, using Pagination to paginate the home page, category, and monthly archives, you can click here for an example of a long entry that has been split into 2 pages.
How it Works
My goal here was to create a pagination plugin with high performance. I didn't want it to slow down rebuilds, and I wanted pages to display for readers without delay. With these goals in mind, I decided to dynamically render pages 2, 3, 4, and so on. This means that unlike the default for most pages in Movable Type, pages 2+ are not static files that get published to your blog directories. They dynamically rendered by the plugin's page viewer script. Note that this viewer script is Perl-based and does not use MT's built-in PHP-based dynamic publishing system. The benefit of this is that you can virtually any plugin template tags in your paginated templates, and you don't need to use PHP. So when someone views page 2, the script goes into action and builds the page and displays it.
Paginated URLs are clean, ending in index.html?page=2 (or similar). Pagination makes use of mod_rewrite for Apache to keep these URLs clean (most MT sites run on Apache, but there may be some alternative approaches for other web servers).
Page-Level Caching
To speed up dynamic page views and reduce CPU/memory/database usage, Pagination supports (optional) page-level caching, powered by the Cache Block plugin. This means that once the plugins generates the HTML for "page 2", it will store that in the cache for next time. And next time someone wants to see "page 2", it can be quickly fetched from the cache. In my tests, dynamic page views from the cache took about 0.04 seconds, so this is very fast. In the plugin settings you can specify how long to cache pages before refreshing the cache.
Template Tags
Pagination comes with a template module that makes it easy to implement -- in most cases you can simply include the module in your existing templates and it will 'just work'. So you may not need to learn or use the template tags below. But if you want to customize the appearance of your Pagniation links, you can use/edit the following tags:
- <mt:PaginationPages> - This is a container tag for displaying linked page numbers, previous / next page links, etc. This tag should only be placed inside the following containers: <mt:EntriesFooter>, <mt:EntriesHeader>, <mt:CommentsFooter>, and <mt:CommentsHeader>. There are several arguments:
- max_pages - (Required) The maximum number of page numbers to display at one time. Note that page numbers will roll forward as readers view higher page numbers, just like Google paginated search results.
- glue - (Optional) This should contain some text or symbols that you to display bewteen each page number. For example, if you want 1 - 2 - 3, then use glue=" - ".
- lastn - (Required) The number of items shown on each page. This must match the lastn argument of the parent <mt:Entries> or <mt:PaginatedComments> tag.
- archive_type - (Optional) For advanced use, you can use this tag to override the archive_type used to calculate the page numbers and links. If omitted, the plugin will use the archive_type of the page being built.
- class_type - (Optional) For advanced use, this tag will override the type of MT object being counted to determine the number of pages.
- <mt:PaginationPageNumber> - Used inside a <mt:PaginationPages> container, this tag will display the page number being processed in the loop (not the current page number that is being published/viewed).
- <mt:PaginationPageLink> - Used inside a <mt:PaginationPages> container, this tag will display the URL to page number being processed in the loop.
- <mt:IfPreviousPage> - Conditional tag that is true if the page being displayed is 2 or higher.
- <mt:PaginationPreviousPageLink> - The URL to the previous page.
- <mt:IfNextPage> - Conditional tag that is true if the currently viewed page is not the last page.
- <mt:IfNotLastPage> - Conditional tag that is relative to the page being processed, not the page being viewed - returns true if the page being processed is not the final page.
- <mt:LastPageLink> - The URL to the last page.
- <mt:LastPageNumber> - The number of the last page.
- <mt:NextPageNumber> - The number of the next page.
- <mt:PreviousPageNumber> - The number of the previous page.
- <mt:PaginatedComments> - (Pro only) This is replacement container tag for <mt:Comments>. If you want to paginate the list of comments on an Entry archive, you should use <mt:PaginatedComments> instead of <mt:Comments>. You can use all the same <mt:Comment_____> tags inside the container. Arguments include:
- show - The number of comments to show per page. (Note that you can also use 'lastn' for this argument)
- offset - The offset for the page of comments. This should always be set to "$pagination_offset".
Template Tags for Entry Pagination
A new feature in Pagination Pro enables you to split long entries into multiple pages by adding <!--nextpage--> (on a line by iteself) when writing the entry, in either the main "Body" or "Extended" fields. Then, using the following template tag modifer or tags, you display only the current "part" of the entry, along with pagination links. Note: in order to differentiate this type of pagination, the term "part" is used instead of "page" -- think of it as splitting an entry into multiple parts.
(Note that using <!--nextpage--> for page breaks is consistent with the built-in feature of Wordpress. This consistency may come in handy for sites migrating from WP to MT, as the existing page breaks should "just work".)
The easy way to use this feature is to use a new modifier called paginate on the tag that you want to split into parts for example:
<mt:EntryBody paginate="1">
or
<mt:EntryMore paginate="1"> (if your page breaks are added to the "Extended" field)
Simply add the paginate="1" argument to your existing tags in your Entry archives and MT will display only the relevant part of the field, along with pagination links at the bottom.
If you want more flexibility, instead of using the modifier described above, you can use the following template tags to control the display of the parts and page numbers:
- <mt:PaginatedTag> - This container is designed to container the part(s) and page links for a paginated Entry Field. There is one required argument:
- tag - The tag with the page breaks, without the "mt:" prefix. Valid values are 'EntryBody' and 'EntryMore'. Example: <mt:PaginatedTag tag="EntryBody">
- <mt:CurrentPart> - This tag displays the current part of the tag (part 1 on page 1, part 2 on page 2, etc.). This tag must be used inside a <mt:PaginatedTag> container.
- <mt:Parts> - This container tag list the pages and page links for each part, if page breaks exist in the specified tag. This tag must be used inside an <mt:PaginatedTag> container. There is one optional argument:
- glue - the value of glue will act as a separator between each part number. Example: <mt:Parts glue=" | ">
- <mt:PartNumber> - Displays the part number.
- <mt:PartLink> - Displays the URL that links to page for the part.
- <mt:IfPreviousPart> - Conditional tag that is true if the part being displayed is 2 or higher.
- <mt:PreviousPartLink> - The URL to the previous part.
- <mt:IfNextPart> - Conditional tag that is true if the currently viewed part is not the last part.
- <mt:NextPartLink> - The URL to the next part.
Variables: For advanced usage, several variables are set by the plugin. A global variable called 'current_part_number' will be assigned to the value of currently displayed part on pages 2+, but remains undefined on page 1. Within an <mt:Parts> container, a local variable called 'current_part' is assigned to a value of 1 if the part being processed is the currently displayed part. Finally, standard loop variables such as __first__, __last__, etc. are assigned and can be used inside <mt:Parts>
Complete Example:
<mt:PaginatedTag tag="EntryMore">
<mt:CurrentPart>
<mt:Parts glue=" ">
<mt:If name="__first__">
<div class="partination"><p><strong>Page:
<mt:IfPreviousPart>
<a href="<mt:PreviousPartLink>">« Prev</a>
</mt:IfPreviousPart>
</mt:If>
<mt:If name="current_part">
<mt:PartNumber>
<mt:Else>
<a href="<mt:PartURL>"><mt:PartNumber></a>
</mt:If>
<mt:If name="__last__">
<mt:IfNextPart>
<a href="<mt:NextPartLink>"> Next »</a>
</mt:IfNextPart>
</strong></p></div>
</mt:If>
</mt:Parts>
</mt:PaginatedTag>
Note: the template tags above will only work on templates published using MT's default "static" publishing system. The tags will generate an error if used on dynamically published templates.
Templates Set
Pagination comes with two templates:
- Pagination - A template module that can be included in other templates to display page links.
- HTACCESS for Pagination - An index template that builds the required mod_rewrite rules. Important: The output file for this template has been set to "htaccess.txt" on purpose. Some sites have already have a ".htaccess" file and you want to be careful not to overwrite the existing one (for example, if you use MT's PHP dynamic publishing, with my Fast Search plugin or otherwise). Check to see if you already have an .htaccess file and if you do, you may want build this template as "htaccess.txt" and then copy and paste the rules into the appropriate place in your .htaccess file (if using MT's dynamic publishing, paste before the existing rules.) If you want to use this template to build your .htaccess file, you will need to change the output file to ".htaccess".
Requirements
- MT4+
- Apache mod_rewrite (for clean URLs)
- Template Installer plugin
Note: while not required, the Cache Block plugin is needed if you want to use the Pagination caching features (highly recommended).
Installation
- Download the zip file and upload the contents of the 'plugins' folder to the 'plugins' directory of your MT installation.
- Change the permissions of the /plugins/Pagination/pages.cgi script to 755 (CHMOD 755).
- Go to the blog you want and then to Preferences > Plugins and then open the settings for the Pagination plugin. Enable the caching settings if desired, then Save.
- Return to the settings and click the "Install Templates" button. This will install the templates mentioned above.
- Setup your .htaccess file with the Pagination rules, as described above.
- Edit your Main Index template and add the following before the </MTEntries> tag:
<mt:EntriesFooter>
<mt:Include module="Pagination">
</mt:EntriesFooter> - Modify your <MTEntries tag to include the argument offset="$pagination_offset". This is important. Example: <MTEntries lastn="10" offset="$pagination_offset">
- (Pro only) Do the same for your "Entry Listing" archive template, for both MTEntries containers.
- (Pro only) If you want to paginate your comment listings on your Entry archives, edit the "Comments" template module to replace the <MTComments> container with the MTPaginatedComments container, as discussed above. Be sure to include show="10 offset="$pagination_offset".
- (Pro only) If you want to paginate long entries on your Entry archives, edit your Entry archive (or relevant template module) to replace or modify the EntryBody or EntryMore tags, as described above.
Get Pagination Pro
Get Pagination
Pagination is free for personal or commercial use, but you must leave the "powered by" link, which is added automatically below the paginations links.
Download Now
As always, comments, questions, and suggestions are welcome.



Comments (31)
great, thanks mark :)
Posted by Pouya
|
September 14, 2008 12:55 AM
Posted on September 14, 2008 00:55
Thank you for develop this plugin.
Posted by Shahab
|
September 14, 2008 4:45 AM
Posted on September 14, 2008 04:45
i used some php code in my template, in the index page every thing is fine, but in other pages my Php codes dose not work, is there any way to fix this problem?
Posted by Pouya
|
September 14, 2008 4:55 AM
Posted on September 14, 2008 04:55
Mark,
I purchased Pagination Pro 1.4 but haven't been able to run it because of a problem noted in my comments to the 1.4 thread. I'm hoping 1.5 will fix that problem, but I don't see a way to download the Personal License version without repaying. Do I have to repay to get this new version, or am I missing something?
Posted by dramnok
|
September 15, 2008 2:54 AM
Posted on September 15, 2008 02:54
dramnok, you should have received an automated email with a download link to the new version. If you didn't, you can use the contact link above.
Also note that there was never a 1.4 version...
Posted by Mark Carey
|
September 16, 2008 9:58 AM
Posted on September 16, 2008 09:58
Hi Mark,
Nice plugin. I got the plugin installed fine and it is paginating my entry listing pages (I have a pro license) but it is not sorting the entries the way I want. I have the sort_by of mt:Entries set to a custom field. The Pagination plugin is taking the 10 most recent entries from my blog and then sorting those by my customfield for page one, then taking the next ten entries and sorting those by my customfield for page 2, etc.
Is there anyway to have all the entries sorted by my customfield with sort_by and then have pagination plugin paginate the entries in that order? I hope you can respond soon as I'm a time crunch to get this working.
Thanks
Jason
Posted by Jason Truell
|
October 3, 2008 10:06 AM
Posted on October 3, 2008 10:06
Hi Jason,
The Pagination plugin doesn't actually directly control the sorting or deciding what entries to display. Rather, the core mt:Entries tag does that, and the Pagination plugin merely passing the value for the "offset" argument, for pages 2+. One thing to try, is change the "lastn" parameter of mt:Entries to "limit", so it might look something like:
<mt:Entries sort_by="field:foo" limit="10" offset="$pagination_offset">
Posted by Mark Carey
|
October 3, 2008 10:49 AM
Posted on October 3, 2008 10:49
I am having a problem with the pagination displaying the same 10 entries on all pages.
Is there a way to have different entries on the pagse?
Any help is appreciated!
Posted by getdagoss
|
October 6, 2008 7:01 PM
Posted on October 6, 2008 19:01
I'm having the same problem as getdagoss had
"I am having a problem with the pagination displaying the same 10 entries on all pages.
Is there a way to have different entries on the pagse?
Any help is appreciated!"
How were you able to solve it? Please help!
Posted by ikonwire
|
October 16, 2008 7:57 AM
Posted on October 16, 2008 07:57
ikonwire: I am not an expert, but it sounds like a htaccess issue.
Posted by devil
|
October 16, 2008 10:17 AM
Posted on October 16, 2008 10:17
I never did have any luck with the include htaccess file (maybe it's a none-pro thing). It did redirect, but it showed the full (ugly) url, and not a beautiful one.
About htaccess, make sure you've renamed htaccess.txt to .htaccess, and make sure that your site supports htaccess (and mod_rewrite).
Personally, I wrote my own htaccess with more user friendly urls such as site.com/page/1 instead of site.com/index.html?page=1
All in all, a great plugin! I'm probably going to buy the pro version just to support its development
Posted by devil
|
October 17, 2008 2:15 AM
Posted on October 17, 2008 02:15
If you are having template problems (i.e the pagination works, but displays the wrong template/old template) it is most likely due to that you have enabled caching in your pagination settings, but for some reasons you don't have the cache plugin installed. Or it's corrupt / not working. Try disabling the cache settings.
Posted by Niklas Bivald | October 22, 2008 2:10 AM
Posted on October 22, 2008 02:10
Thanks devil. It was the htaccess file.
The problem I have now is that I am using some php code to make my header banners rotate. When I installed the Pagination plugin the first page on the index looks great but when I click on "Next Page" the php code for my header gets stripped out and the page displays wrongly.
Can anyone help with this.
www.youmustbetrippin.com/index_test.php
Posted by ikonwire
|
October 22, 2008 2:42 PM
Posted on October 22, 2008 14:42
To be clear, does comment pagination work with static pages?
Posted by Rob D. | December 6, 2008 7:27 PM
Posted on December 6, 2008 19:27
Hi Mark, I've installed the plugin, but I received un error when i clicked on the next page bottom. the error is "The requested URL /plugins/Pagination/pages.cgi was not found on this server."
What should I do?
Thanks
Posted by saeed
|
December 27, 2008 7:55 AM
Posted on December 27, 2008 07:55
Hi there. I bought the Pro version so I could paginate long entries, and I've installed it and messed with it but can't get it to work. No matter which "page" (part) I look at, I get the first page of the content. I've tried a few different things and just am hitting a brick wall. Can you help? I am willing to pay for consulting if it is necessary. I really need this feature for a new section of my site.
Thanks!
~Angela
Posted by cottagemagpie
|
December 29, 2008 8:28 PM
Posted on December 29, 2008 20:28
I tried installing this as per the instructions.
It shows the pages at the footer, but each page has all the same posts as my index page.
Any help would be appreciated.
Thanks
Posted by joe
|
February 1, 2009 6:00 PM
Posted on February 1, 2009 18:00
I am having a problem with the pagination displaying the same 10 entries on all pages.I've tried a few different things and just am hitting a brick wall
Posted by son haberler | March 6, 2009 3:46 PM
Posted on March 6, 2009 15:46
That's going to come in very handy when I'm experimenting
Posted by دردشة صوتية | March 30, 2009 8:42 PM
Posted on March 30, 2009 20:42
That's going to come شات صوتي
منتديات الوله
in very handy when I'm experimenting
Posted by شات صوتي | April 4, 2009 6:19 PM
Posted on April 4, 2009 18:19
I would need some help here!
this morning I got the Personal License of this plugin... I am going nutz!
I have 4 different "language blogs" on the same MT installation.
I did the same steps for 3 of them but only one works.
www.laleva.org/it/ - - works
www.laleva.org/ - - Doesnt work
www.laleva.org/eng/ - - Doesnt work
I have been doing this since this morning and I can not understand whats going wrong....
I noticed that the owner of the .htaccess are different ... the /it/ is my username and the other get created as nobody so I manually changed the owner but it still doesnt work...
I dont get any errors just blank white pages when I try to go to page 2.
I'm getting really frustrated!
Please someone help me!
Posted by Anonymous | April 21, 2009 10:06 AM
Posted on April 21, 2009 10:06
I bought the Pro version, installed the plugin, and added the code to my template, but it's not displaying any pagination links. I have to checked to make sure caching was off. I'm using the default template. Other text in the
Posted by Jeremiah
|
May 19, 2009 2:42 PM
Posted on May 19, 2009 14:42
have been doing this since this morning and I can not understand whats going wrong....
I noticed that the owner of the .htaccess are different ... the /it/ is my username and the other get created as nobody so I manually changed the owner but it still doesnt work...
I dont get any errors just blank white pages when I try to go
شات صوتي
]دردشة صوتيه
دردشة زين
Posted by شات صوتي | May 25, 2009 6:36 PM
Posted on May 25, 2009 18:36
The Pagination plugin doesn't actually directly control the sorting or deciding what entries to display. Rather, the core mt:Entries tag does that, and the Pagination plugin merely passing the value for the "offset" argument, for pages 2+. One thing to try, is change the "lastn" parameter of mt:Entries to "limit", so it might look something like:
Mr BomB
سعودي كول
شات زين
Posted by سعودي كول | May 31, 2009 8:44 PM
Posted on May 31, 2009 20:44
sorting or deciding what entries to display. Rather, the core mt:Entries tag does that, and the Pagination plugin merely passing the value for the "offset" argument, for pages 2+. One thing to try, is change the "lastn" parameter of mt:Entries to "limit", so it might look something like:
http://www.t7b.com/dlil/show80156.html
Posted by دردشة | August 3, 2009 6:47 PM
Posted on August 3, 2009 18:47
That's going to come in very handy when I'm experimenting
http://www.t7b.com/dlil
Posted by دردشة الشلة | August 3, 2009 6:49 PM
Posted on August 3, 2009 18:49
That's going to come in very handy when I'm experimenting
http://www.t7b.com/dlil
Posted by دردشة الشلة | August 3, 2009 6:49 PM
Posted on August 3, 2009 18:49
hi there, thanks for the great plugin. the issue I'm having is that I only display entries for a certain category on my blog's index page. but the pagination seems to be aware there are more entries for that particular blog. so if I only have 50 entries that would normally publish to the index, but I have 50 more in a different category that would not - the plugin still thinks there's 100 entries there. so it creates way too many page links. and, of course, those pages are just blank.
help please. and hopefully this made sense!
Posted by hdot | September 24, 2009 4:00 PM
Posted on September 24, 2009 16:00
have been doing this since this morning and I can not understand whats going wrong....
I noticed that the owner of the .htaccess are different ... the /it/ is my username and the other get created as nobody so I manually changed the owner but it still doesnt work...
I dont get any errors just blank white pages when I try
Posted by دردشه صوتيه | December 12, 2009 8:17 AM
Posted on December 12, 2009 08:17
When I try to use the Pro version of the plug in on any archive page, I get the following error when I click on the link for the next page:
Can't call method "stash" on an undefined value
Any suggestions about what I can do to get it working?
Posted by Bettina May | January 11, 2010 4:28 PM
Posted on January 11, 2010 16:28
thanks very good
Posted by شات صوتي | January 28, 2010 7:09 AM
Posted on January 28, 2010 07:09