Extension:BackLinksFunctions

When there is a need to:


 * Display how many pages link to a specific page
 * Decide whether one page links to another

BackLinksFunctions may come to mind. For example, you can easily and automatically highlight all the pages that link to a specific category.

Note: The extension is still under development.

Links counters
These functions count number of backward links. They return either
 * the number of direct links
 * or the number of including pages
 * or both

#linking
Returns a number of pages linking to the given page.

#including
Returns a number of pages that include the given template.

#refering
Returns a number of pages linking to or including the given page. This is practically a union of the and  functions.

Note: The #refering function does not count category links. Adding page to a category does not count as a backward link. This is, however not very good, is it? It should be fixed somehow in the future. If and when a missing #belonging function will be available.

Conditions about linkage
These functions works like conditions. They decide if one page links to or includes another and return one phrase or another.

They resembles if-then-else constructs similar to #ifeq parser function.

#iflinksto
If the given page from links to the given page to, returns the given true parameter. Otherwise returns the given false parameter.

#ifincludes
If the given page includes the given template, returns the given true parameter. Otherwise returns the given false parameter.

#ifbelongsto
If the given page belongs to the given category, returns the given true parameter. Otherwise returns the given false parameter.

#ifrefersto
If the given page source links to or includes a page destination, returns the given true parameter. Otherwise returns the given false parameter. If the the destination is a category to which the source page belongs to, true is returned as well.

This is practically a union of the, and  functions.

Caching
In MediaWiki version 1.6 and early versions of 1.7, even pages that use these functions are being cached, as all other pages. The provided information is, therefore, not always up to date.


 * The bug causing this is described here: 5683.
 * You can fix the bug yourself: Enforcing DisableCache.

Installation
Copy and paste the source code below into a file named BackLinksFunctions.php in a new directory called BackLinksFunctions in your extensions directory.

Then put the following at the end of your LocalSettings.php:

Related extensions

 * DynamicPageList has a similar focus

Code
This code has been tested on MediaWiki 1.6.7 and above.

History:


 * 25 Jul 2006 -- v1.0 -- First release.
 * 26 Jul 2006 -- v1.2 -- Added more functions.
 * 29 Jul 2006 -- v1.3 -- Added cache disabling.