Extension:Subpage Fun

What can this extension do?
This extension provides your wiki with seven 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 then 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.

What is Subpage Fun good for?
With this extension you can gain much more informations about a pages subpages than with MWs own magic subpage functions. You can use those new informations for dynamic templates which generate Informations about subpages for example.

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 several more parameters for each of those functions beside 1 which allows to define the page to get the information from. If parameter linked has any value at all the pages in the list become links. Parameter sep allows to define a different list separator than the default separator. Parameter depth works only with  and. It allows to define the relative depth to the most distant page. If the depth is set to a value smaller than 1 or not set the functions will output everything.

 Examples: 


 * will output the currents page direct parent page as link.
 * will output all direct subpages below somepage seperated by a simple space.

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 30, 2009 -- Version 0.3.1: Minor change in extension meta infos for proper appearance in special:version. Extension status is now stable.
 * Dec 10, 2009 -- Version 0.3.0:
 * Changed "2" and "3" parameters for advanced list formations against named parameters linked and sep.
 * Added named parameter depth for  and
 * Dec 9, 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.