Extension:AutoHeader

From mediawiki.org
MediaWiki extensions manual
AutoHeader
Release status: beta
Implementation Skin
Description Calls the template Model:AutoHeader on the top of each page
Author(s) ChloĂŠ Lourseyre (SenuaChloetalk)
Latest version 0.1 (12/02/2023)
MediaWiki
License GNU General Public License 3.0 or later
Download Download
README
Example http://wiki.magnuscodex.net/index.php?title=JdR:La_Couleur_des_Roses

The AutoHeader extension calls the Model:AutoHeader on top of each page of the wiki.

It was initially intended to print a subpage tree inside an infobox on each page (using namespace filtering to not submerge pages that do not need it)

Installation[edit]

  • Download and place the file(s) in a directory called AutoHeader in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'AutoHeader' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

You only need to implement the Model:AutoHeader, and it will be automatically included of the top of each page.

See the examples bellow to see how to filter on which set of pages the auto-header is effectively included, or to see an example of usage of this extension.

Examples[edit]

Filter by namespace[edit]

The following code can be used inside the Model:AutoHeader template to only print the auto-header on a specific namespace

{{#ifeq:{{NAMESPACE}}|JdR|{{Model:JdR:AutoHeader}}|}}

As you can see, this is a simple conditional statement that check the namespace's name.

Example of usage[edit]

The following code what the first intention of the implementation of this extension: it includes an Infobox printing the subpage tree using Extension:SubPageList3.

{{Infobox 
| bodystyle = background:#1f2845; color:#e8effc; text-align:left; width:400px;
| datastyle = background:#171e33; color:#e8effc; text-align:left;
| headerstyle = background:#1f2845; color:#e8effc;
| header1 = [[{{NAMESPACE}}:{{ROOTPAGENAME}}|{{ROOTPAGENAME}}]]
| data2 = <splist parent="{{NAMESPACE}}:{{ROOTPAGENAME}}" showparent=no liststyle=unordered />
}}