Extension:Simple Breadcrumb

From mediawiki.org
MediaWiki extensions manual
Simple Breadcrumb
Release status: unmaintained
Implementation Parser function , Hook
Description Implements a simple hierarchical breadcrumb
Author(s) Nicolas Bernier (NicolasBernier81talk)
Latest version 1.0 (2012-12-05)
MediaWiki 1.16.0
PHP 5.2.4
License LGPL v3.0
Download
README

The extension implements a {{#breadcrumb: }} tag to set a parent page for each page. The resulting breadcrumb is displayed under the page title. Tested with MediaWiki version 1.16.0 and 1.19.1.

Usage[edit]

Just add a {{#breadcrumb: }} tag anywhere in your page to set its parent.

{{#breadcrumb: Parent_Page | Parent }}

The tag can be used in templates and accepts variables.

{{#breadcrumb: Category:Releases {{{product}}} | {{{product}}} }}

You should not add more than one breadcrumb tag in your page.

Installation[edit]

  • Copy SimpleBreadcrumb.php and SimpleBreadcrumb.i18n.php in your extensions directory.
  • Edit LocalSettings.php to include the extension :
// Simple Breadcrumb
require_once('extensions/SimpleBreadcrumb.php');

Configuration[edit]

The extension offers a bunch of configuration variables that can be overridden in LocalSettings.php after the inclusion of the extension.

SimpleBreadCrumb::$fillTagOnNewPage               = true;         // Fill the breadcrumb tag when editing a new page
SimpleBreadCrumb::$selfLink                       = true;         // Enable link on the current active page in the breadcrumb
SimpleBreadCrumb::$delimiter                      = ' > ';     // Breadcrumb delimiter string
SimpleBreadCrumb::$maxCount                       = 5;            // Maximum elements in breadcrumb
SimpleBreadCrumb::$overflowPrefix                 = '[…]'; // Prefix when breadcrumb has more elements than fixed limit
SimpleBreadCrumb::$onOutputPageBeforeHtmlCallback = null;         // Callback function to override the SimpleBreadCrumb::onOutputPageBeforeHtml() hook
SimpleBreadCrumb::$renderCallback                 = null;         // Callback function to override the SimpleBreadCrumb::render() method

Do not call SimpleBreadCrumb::onOutputPageBeforeHtml() and SimpleBreadCrumb::render() within the callbacks to avoid infinite recursion. Refer to SimpleBreadcrumb.php to see how it's called.

Troubleshooting[edit]

If the extension doesn't seem to work (tag {{#breadcrumb }} still visible), try truncating the wiki_l10n_cache table, this should fix the issue.