Extension:Subpage Fun

What can this extension do?
This extension provides your wiki with several new parser functions/variables to get informations about subpages you can't get with MediaWikis existing magic Words.

What exactly is a subpage?
You can read almost everything you need to know about MediaWiki subpages here. This extension goes one step further and says a subpage is not simply the part behind a slash (/). A page is only than a subpage when a parent page exists. This means a page AC/DC won't be a subpage as long as the page AC doesn't exist. Assuming the page AC/DC/Discography exists, the page AC/DC/Discography/1975/1976 would have the  1975/1976. The MediaWiki  variable would only output 1976 in this case which is nonsense since this page doesn't even exist.

Usage
Subpage Fun defines,  ,  ,  ,   and. You can use them either like that as variables for the current page or you can use them with a parameter like  to use them for any page you want.


 * SUBPAGETITLE: The real name of a subpage, not only the part behind the last slash (/) like MediaWiki's SUBPAGENAME outputs it.
 * SUBPAGES: Outputs all Subpages as a comma separated list. This means all descendant pages, not only direct child pages. The output has no specific order.
 * PARENTPAGES: Outputs all ancestor pages as a comma separated list. The output begins with the top level page and ends with the direct parent page.
 * SIBLINGPAGES: Outputs all sibling pages of the same subpage level and tree as a comma separated list. The output has no specific order.
 * SUBPAGELEVEL: The subpage level of a page. A normal page which is no subpage at all would return 0.
 * NUMBEROFSUBPAGES:	How many subpages does a page have. Also works with subpages to see how many subpages they have. Counts all descendant pages, not only direct child pages.
 * TOPLEVELPAGE: The top level page which is the page with subpage level 0 within the same subpage tree.

Advanced list formations
,,   have a list output. You can use this output for further use with Extension:ArrayExtension for example.

There are two more parameters for each of those functions beside 1 which allows to define the page to get the information from. If parameter 2 has any value at all the pages in the list become links. Parameter 3 allows to define another list separator than the default separator.

Example:

Developers support
Developers can use some static php functions from the SubpageFunction class which delivers informations about subpages which the MediaWiki Title class doesn't provide.

Download instructions
You can take the code from /Source code. Create a new directory SubpageFun in your MediaWiki's extension directory and put the code in a new file LocalSettings.php there.

Installation
To install this extension, add the following to LocalSettings.php:

Change Log
the latest Subpage Fun extension has been tested on MediaWiki version 1.15

 History 
 * Dec 10, 2009 -- Version 0.2.0: Variable/function  added.
 * Dec 9, 2009 -- Version 0.1.0: First release of Subpage Fun. Comes with the six variables/functions,  ,  ,   and.