Extension:Simple Breadcrumb

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Simple Breadcrumb

Release status:Extension status beta

ImplementationTemplate:Extension#type Parser function, Hook
DescriptionTemplate:Extension#description Implements a simple hierarchical breadcrumb
Author(s)Template:Extension#username Nicolas Bernier (NicolasBernier81talk)
Latest versionTemplate:Extension#version 1.0 (2012-12-05)
MediaWikiTemplate:Extension#mediawiki 1.16.0
PHPTemplate:Extension#php 5.2.4
LicenseTemplate:Extension#license LGPL v3.0
Download
README
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
ParserBeforeTidyManual:Hooks/ParserBeforeTidy
OutputPageBeforeHTMLManual:Hooks/OutputPageBeforeHTML
EditFormPreloadTextManual:Hooks/EditFormPreloadText
PageContentSaveCompleteManual:Hooks/PageContentSaveComplete
ArticleSaveCompleteManual:Hooks/ArticleSaveComplete

Translate the Simple Breadcrumb extension if it is available at translatewiki.net

Check usage and version matrix.

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 overriden 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.