Extension:Header Footer

(Redirected from Extension:HeaderFooter)
MediaWiki extensions manual
HeaderFooter
Release status: unmaintained
Description Provides per-namespace and per-page header + footer inclusion
Author(s) Jean-Lou Dupont
Maintainer(s) James Montalvo
Latest version 3.0.1 (2020-12-20)
MediaWiki 1.25+
Database changes No
Composer mediawiki/header-footer
License GNU General Public License 2.0 or later
Download
releases

  • $egHeaderFooterEnableAsyncHeader
  • $egHeaderFooterEnableAsyncFooter

The Header Footer extension provides per-namespace and per-page header and footer inclusion.

FeaturesEdit

  • 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

InstallationEdit

The recommended way to install this extension is using Composer with MediaWiki's built-in support for Composer .

Step 1

Change to the base directory of your MediaWiki installation. This is where the "LocalSettings.php" file is located. If you have not yet installed Composer do it now by running the following command in your shell:

wget https://getcomposer.org/composer.phar

As of September 2020 that version is the beta, which is incompatible with at least some MediaWiki installations. The stable version is at getcomposer.org/download.

Step 2

If you do not have a "composer.local.json" file yet, create one and add the following content to it:

{
	"require": {
		"mediawiki/header-footer": "~3.0"
	}
}

If you already have a "composer.local.json" file add the following line to the end of the "require" section in your file:

"mediawiki/header-footer": "~3.0"

Remember to add a comma to the end of the preceding line in this section.

Step 3

Run the following command in your shell:

php composer.phar update --no-dev

Note if you have Git installed on your system add the --prefer-source flag to the above command. Also note that it may be necessary to run this command twice. If unsure do it twice right away.

Step 4

Add the following line to the end of your "LocalSettings.php" file:

wfLoadExtension( 'HeaderFooter' );
Verify installation success

As final step, you can verify Header_Footer got installed by looking at the "Special:Version" page on your wiki and check that it is listed.

UsageEdit

Per-Namespace Header and FooterEdit

Edit the pages:

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

namespace name must be in the language of the wiki (see Manual:$wgLanguageCode)

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 FooterEdit

Edit the pages:

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

Disable commandsEdit

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

CSSEdit

  • 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">

ExamplesEdit

  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.

See alsoEdit

  • 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).