User:Brion.finlay/PathFunctions

This extension provides custom variables that allow specifying the page to use when evaluating page specific MediaWiki variables for page names, namespaces, and latest revisions (for example, ), , and.

Normally, for the rendering on page A, these variables depend on page A, even if page A contains the variable due to inclusion of page B. This extension allows you to evaluate the variables for page B or any other page and display the results on page A.

Example

 * gives Foo
 * gives Help
 * gives the latest revision id for Help:Foo

Uses

 * When including one article into another, this allows you to display information about the included page.
 * When including article B into article A, this allows you to display on page A the variables for the included page B.
 * For the rendering on page A, these variables depend on page A, even if page A contains the variable due to inclusion of page B.
 * When building templates, this allows you to extract portions of an article name passed in as a parameter.

Latest revision to a page
The following variables return data about the latest edit to the specified page, even if viewing an older version of the page.

Page names
The following are URL-encoded equivalents:

Namespaces
The following are URL-encoded equivalents:

Configuration
Setting the variable $wgPathFunctionsUseNoPrefixHash to true allows the variables to be used without the preceeding hash symbol, and so appear more like the built in variables. For example.

Installation
Add this line to LocalSettings.php: require_once( "$IP/extensions/PathFunctions/PathFunctions.php" );

And copy the following to extensions/PathFunctions/PathFunctions.php and extensions/PathFunctions/PathFunctions.i18n.php: