Extension:SubPageFunctions

What can this extension do?
When creating a tree of subpages, this extension will provide navigation links from a parent page to its immediate subpages. It is the counterpart to the wiki's parent page links.

You may slice and dice subpage names to select parts of the name using the pathname function.

When compiling educational documents, you may create a table linking to them, using the calendar function.

The user function returns the current user name, useful when creating personalised pages.

subpages
The syntax is Where  NAMESPACE is an optional namespace name, e.g. Project, Help, MyNamespace, etc. 0 (numerical zero) is the main namespace, often called Article. 

The default is to use the page's namespace, so you can omit the argument. You may use the function more than once for different namespaces.

You may add the function anywhere on the page. It will create a centered title and a three column list of subpage links. If there are no subpages, the function will output nothing.

pathname
The syntax is Where  start An integer representing the first component in the pathname. length</dt> An integer representing the number of components.</dd> </dl> The pathname can be trimmed from both the front or back. The length is similarly selected from either the front or back.

Given the page name

It only operates on the current page name in a similar way to and , so you cannot pass it arbitary text. It becomes useful when using more than three subpage levels.

calendar
The syntax is Where  namespace</dt> The namespace of the target pages.</dd> pageprefix</dt> The parent page in the namespace.</dd> </dl> Returns a table where the columns are subpages of pageprefix and the rows are sub-subpages of pageprefix. If pageprefix is omitted, the current page name is used. If the namespace is omitted, the current page's namespace is used.

Given the following pages: the function in the Extension:SubPageFunctions page will produce the following table: If a page is a redirect, it is marked as Redirect instead of Available. The row names examples and intro are composite names taken from the sub-subpages.

user
The syntax is This function takes no arguments and returns the current logged in user name. This is useful when creating user subpages, for example, given the current user is Foo: will link to: The actual link will vary from user to user, creating multiple unique pages by user name, but each user will only see their link. The function can be used anywhere text is allowed, not just links. Most useful with SemanticMediaWiki and SemanticForms.

Download instructions
Source details can be found on.

Untar the file to your MediaWiki extensions directory and follow the Installation section.

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

Configuration parameters
No configuration parameters are available.

User rights
Default rights.

File permissions
The SubPageFunctions_magic.php file is used for language translaton, so it was considered a good idea to allow webmasters to update the file and not allow the package to overwrite it. For new installations, the package would see the file is missing and generate a default one from SubPageFunctions_magic_sample.php.

Unfortunately, this means the extension must have write permission for the extension/SubPageFunctions directory, on first installation. Every time the extension finds the magic file is missing, it will try create a new default one.

It is now considered a bad idea because webmasters may want to prevent the extension writing to the directory and preventing it will cause the extension to potentially fail with php errors.

The current release includes the magic file to avoid installation problems, but the extension will still try to create the file, if it is moved or deleted.