Not a developer? Go to MovableType.com

Plugin and Theme Directory

Hybrid Pagination v1.0

By Brad Choate
Posted December 10, 2008, in Dynamic Publishing.

Details

Hybrid Pagination, a plugin for Movable Type

This plugin provides a means for doing pagination of a template module in Movable Type. It expects the following:

  • An index template that is statically published, as a PHP file.
  • A template module that is written to support pagination.

From the index template, you would make use of the "PaginateModule" MT tag which is provided by this plugin. It works much like the MT "Include" tag, when used with a "module" attribute. For example:

<$MTPaginateModule module="Entries Loop"$>

The template module should look something like this (paginates by 20 entries):

<MTEntries offset="auto" lastn="20">

    (place your entry summary markup here)

<mt:IfStatic>
<mt:EntriesFooter>
    <mt:EntryNext setvar="has_more">1</mt:EntryNext>
</mt:EntriesFooter>
</mt:IfStatic>
</MTEntries>

<div class="content-nav">
<mt:IfDynamic>
<mt:IfPreviousResults>
    <a rel="prev" href="<$mt:NextLink>">&lt; Older &nbsp;</a>
</mt:IfPreviousResults>
<mt:PagerBlock>
    <mt:IfCurrentPage>
        <$mt:Var name="__value__"$>
    <mt:Else>
        <a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a>
    </mt:IfCurrentPage>
    <mt:Unless name="__last__">&nbsp;</mt:Unless>
</mt:PagerBlock>
<mt:IfMoreResults>
    <a rel="next" href="<$mt:PreviousLink$>">&nbsp; Newer &gt;</a>
</mt:IfMoreResults>
</mt:IfDynamic>
<mt:IfStatic>
<mt:If name="has_more">
    <a rel="prev" href="?offset=20">&lt; Older</a>
</mt:If>
</mt:IfStatic>
</div>

This produces a simple single "Older" link for the statically published page which takes you to the hybrid static and dynamic page, which then offers full navigation for the module. If you are paginating something other than a MTEntries tag, you can use the same mechanism, but you may need to gather the 'offset' query parameter manually and use it to display the range of results you desire.

Installation

To install this plugin, drop the files included with this plugin into your Movable Type directory (under the plugins/HybridPagination directory).

For a guide to installing Movable Type plugins packaged in this way, please visit http://tinyurl.com/6dfsm3

Requirements

PHP

Compatibility

Movable Type versions: 4.3


Back