Extension:Header Footer

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

Release status:Extension status stable

DescriptionTemplate:Extension#description Provides per-namespace and per-page header + footer inclusion.
Author(s)Template:Extension#username
Latest versionTemplate:Extension#version 2.2.1 (2015-02-03)
MediaWikiTemplate:Extension#mediawiki 1.21+
ComposerComposer mediawiki/header-footer
LicenseTemplate:Extension#license No license specified
Download See download section
ExampleTemplate:Extension#example [1]
Hooks usedTemplate:Extension#hook
OutputPageParserOutputManual:Hooks/OutputPageParserOutput

Translate the Header Footer extension if it is available at translatewiki.net

Check usage and version matrix.

Purpose[edit source]

Provides per-namespace and per-page header and footer inclusion.

Features[edit source]

  • Speed: integrated with parser caching
  • Secure: header and footer articles are located in the NS_MEDIAWIKI namespace
  • Controllable: headers and/or footers can be disabled on pages which are edit protected
  • Customizable: headers and footers are wrapped in <div> elements

Installation[edit source]

MediaWiki 1.22+[edit source]

Install with Composer by performing one of the following commands

  • composer require mediawiki/header-footer ~2.1 for the latest stable version or
  • composer require mediawiki/header-footer 'dev-master' for the latest development version

No changes to LocalSettings.php are required when installing with Composer.

MediaWiki 1.21+[edit source]

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://github.com/jamesmontalvo3/MediaWiki-HeaderFooter.git HeaderFooter

Require in LocalSettings.php[edit source]

When not installing with Composer, make the following modification to LocalSettings.php.

Download the files as described above, put them in your MediaWiki extensions folder, then include this line in your LocalSettings.php file:

require_once("$IP/extensions/HeaderFooter/HeaderFooter.php");

Usage[edit source]

Per-Namespace Header and Footer[edit source]

Edit the pages:

  • MediaWiki:Hf-nsheader-namespace name
  • MediaWiki:Hf-nsfooter-namespace name

For the 'main' namespace, just use blank i.e. no string, but with the hyphen:

  • MediaWiki:Hf-nsheader-
  • MediaWiki:Hf-nsfooter-

Per-Page Header and Footer[edit source]

Edit the pages:

  • MediaWiki:Hf-header-page name
  • MediaWiki:Hf-footer-page name

Disable commands[edit source]

On edit protected pages, one can add

  • __NOHEADER__ to suppress the page level header
  • __NOFOOTER__ to suppress the page level footer
  • __NONSHEADER__ to suppress the namespace level header
  • __NONSFOOTER__ to suppress the namespace level footer

CSS[edit source]

  • Page Level Header: <div class="hf-header">
  • Namespace Level Header: <div class="hf-nsheader">
  • Page Level Footer: <div class="hf-footer">
  • Namespace Level Footer: <div class="hf-nsfooter">

Examples[edit source]

  1. Page MediaWiki:hf-nsheader-Extension would contain the wikitext to be included as header for all pages of the Extension namespace.
    • In this case, to suppress the header of the page Extension:HeaderFooter one should a) edit protect it, and b) add __NONSHEADER__ in it.
  2. Page MediaWiki:hf-footer-Extension:HeaderFooter would contain the wikitext to be included as footer for the page Extension:HeaderFooter.
    • In this case, to suppress the footer of the page Extension:HeaderFooter one should a) edit protect it, and b) add __NOFOOTER__ in it.

Dependency[edit source]

Versions for MediaWiki 1.17 and below are dependent upon the StubManager extension. That dependency has been removed for MediaWiki 1.21+.

Release History[edit source]

  • 2.0.0: Complete redesign --Jean-Lou Dupont
  • 2.0.1: Fixed bug related to disable keywords (e.g. __NONSFOOTER__) --Jean-Lou Dupont
  • 2.0.2: Updated to work with MW 1.21 and removed StubManager dependency. Moved revision control from SVN to GitHub. --James Montalvo
  • 2.1.0: Updated to allow installation via Composer --James Montalvo
  • 2.1.1: Convert deprecated msg formats; code format cleanup --James Montalvo

See also[edit source]

  • Extension:HeadersFooters an independent implementation of similar functionality.
  • Extension:PageNotice: The PageNotice extension provides a way for you to define fixed notice messages for the top or the bottom of a page (by individual page name), or entire namespaces (by namespace number).