Extension:SubPageList

{{extension
 * status     = stable
 * type1      = tag
 * type2      = pfunc
 * hook1      = ParserFirstCallInit
 * hook2      = TitleMoveComplete
 * hook3      = ArticleInsertComplete
 * hook4      = ArticleDeleteComplete
 * hook5      =
 * author     = Jeroen De Dauw, based on SubPageList3
 * image      = Splist 1.png
 * imagesize  = 200
 * version    = 0.5
 * update     = 2011-12-27
 * mediawiki  = 1.16.0 or above
 * license    = GPL v3 or above
 * download   = Stable releases - All releases
 * needs-updatephp = no
 * description = Adds a  tag that enables you to list subpages
 * tags       =   or   parser hook that you can use to list subpages.
 * Backward compatible with the SubPageList3 extension.
 * Supports multiple parameters that enable you to customize the subpage list.
 * Full integration with the Validator extension.

Download
SubPageList requires Validator 0.4.2 or above in order to work. A compatible copy of Validator always comes bundled with the regular releases, and is automatically loaded by SubPageList, so you do not need to worry about it when using one of these. If you are getting the code from SVN, make sure you also get a copy of Validator (see here for instructions).

Installation
Once you have downloaded the code, place the SubPageList and Validator directories within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file:

MediaWiki has a setting that specifies which namespaces can have subpages. For namespaces where this is not set, creating  will not result in   being a child page of. See Manual:$wgNamespacesWithSubpages. Typically you want to also enable this for the main nemspace, as follows:

Configuration
Configuration of SubPageList is done by adding simple PHP statements to your LocalSettings.php file. These statements need to be placed AFTER the inclusion of SubPageList. The options are listed below and their default is set in the SubPageList settings file. You should NOT modify the settings file, but can have a look at it to get an idea of how to use the settings, in case the below descriptions do not suffice.

Automatic refresh
As of version 0.3, you can choose to automatically refresh subpage lists that are on the base page of subpages you add, move or delete, or on one of the subpages of the base page. This behaviour is off by default as it can produce extra load on your server, but can be turned on with this code:

General subpage settings
MediaWiki itself has some support for subpages, which causes back links to be displayed on subpages to their parent pages. To enable this you need to set wgNamespacesWithSubpages, which is a per namespace setting, like shown below:

Usage
You have the choice to either use a tag extension (  or   ) or use a parser function (   or   ). All these take the same parameters and behave identically.

Syntax
Tag extension with only the required parameters.

Tag extension with all parameters.

 Tag extension with all parameters using the default parameter notation.

{page, Text} Parser function with only the required parameters.

Parser function with all parameters.

Parser function with all parameters using the default parameter notation.

Examples
Listing the subpages of the current page with default options:

Listing the subpages of page "Foobar" with the "ol" format:



Using several options and making use of the default parameter system of the parser function (again for page "Foobar"):

Version
This is a copy of the release notes file on SVN, which might be more up to date than this page.

Version 0.5
2011-12-27


 * Added compatibility with MediaWiki 1.18 (bug 33393) and 1.19.
 * Dropped compatibility with MediaWiki 1.15.
 * Added #subpagecount parser hook.
 * Fixed invalid HTML for ul and ol formats (bug 32131).

Version 0.4
2011-07-27


 * Added parameters for better output control: element, class, intro, outro, default, separator, template, links.
 * Added ability to list pages in a namespace.
 * Fixed compatibility with MediaWiki 1.18.

Version 0.3
2011-03-05


 * Added $egSPLAutorefresh option.
 * Fix to display of the first list item.
 * Fixed inverted behaviour of the kidsonly parameter.
 * Fixed query issue when using PostGres.

Version 0.2
2011-01-24


 * Fixed escaping issue when using the parser function.
 * Fixed bug in pathstyle and sortby parameters.
 * Added parameter descriptions.

Version 0.1
2010-12-31


 * Copied the code of SubPageList3 and ...
 * Modified code to make use of Validator for parameter handling.
 * Rewrote most code of the SubPageList class.
 * Fixed namespace bug.
 * Fixed several minor layout issues.
 * Added 18n magic file.
 * Added COPYING, INSTALL, README and RELEASE-NOTES.
 * Cleaned up and corrected formatting.

Internationalization
SubPageList is fully internationalized. Translation of SubPageList messages is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

Authors
SubPageList has been written by Jeroen De Dauw, and is a rewritten version of SubPageList3, which was written by James McCormack, Martin Schallnahs and Rob Church.