Manual:Pager.php

The IndexPager class provides useful functions for paging results of MySQL query fieldset results.

The IndexPager class is used for example in the special page Special:Categories.

Usage example
The first step to use the IndexPager in your special page extensions is creating a class named for example  that extends one of these three classes:


 * is used when you want to list your items in alphabetical order


 * is used when you want to list your items in a reverse chronological order


 * is used when you want display items in table rows

Each of these three class (,  and  ) extends the   class.

Usually you should only have to override few methods in your class:


 * let the pager know the SQL query you want to execute. It should return an associative array with the following elements:


 * table(s) used in the query,


 * field(s) for passing to Database::select, may be * (all fields in table),


 * an array containing conditions for WHERE clause,


 * an array containing other options (such as GROUP BY).


 * gets an argument,, which is a row object from the result fieldset. The function should return a string containing the item formatted as you need.


 * should return the name of the table field used for indexing and ordering results.

For example, if you want to list all pages in the NS0 using a pager, you should do something like that:

In your special page body than you have to:
 * create a new  class
 * use the  method for putting the navigation bar on the top and on the bottom of the page
 * use the  method for putting the list of the items.

For example: