Manual:Pager.php/fr

La classe IndexPager fournit des fonctions utiles pour pour la pagination des résultats des champs d'une requête MySQL. La classe IndexPager est utilisée par exemple dans la page spéciale Spécial:Catégories.



Exemples d'utilisation
La première étape pour utiliser IndexPager dans votre extension de page spéciale est de créer une classe nommée par exemple  qui étend une de ces trois 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 a 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:

