Extension:Editheader
This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net . |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
![]() Release status: unmaintained |
|
---|---|
Description | Adds a page in the MediaWiki namespace to the top of pages automatically |
Author(s) | X!talk |
MediaWiki | 1.6.0+ |
License | GPL |
Download | See below |
What can this extension do?Edit
This extension includes a system message at the top of a certain page.
UsageEdit
To add a header to a page, create a page at "MediaWiki:Header-NS-PAGE" where NS is the numerical namespace code (e.g. 2 = User, 4 = Project) and PAGE is the page where you want it to show (excluding the namespace).
- Example: To add a header on "Talk:Foo", create a page at "MediaWiki:Header-1-Foo" (page names without quotation marks, of course).
Download instructionsEdit
Please cut and paste the code found below and place it in $IP/extensions/Editheader/Editheader.php
.
InstallationEdit
To install this extension, add the following to LocalSettings.php :
require_once("$IP/extensions/Editheader/Editheader.php");
CodeEdit
<?
if (!defined('MEDIAWIKI')) die();
/*
* Editheader extension
*
* Written by Soxred93
*
* Licensed under the GPL
*
*/
$wgExtensionCredits['other'][] = array(
'name' => 'Editheader',
'author' =>'[http://en.wikipedia.org/wiki/User:Soxred93 Soxred93]',
'description' => 'Adds a message to the top of a page, without using a template.',
'descriptionmsg' => 'editheader-desc'
);
$wgHooks['ArticleViewHeader'][] = 'fnEditheaderText';
function fnEditheaderText( &$article, $outputDone, $pcache ) {
global $wgOut;
$title = $article->mTitle->mTextform;
$namespace = $article->mTitle->mNamespace;
$msg = urlencode( strtolower( "header-$namespace-$title" ) );
$x = wfMsg($msg);
if( !wfEmptyMsg( $msg, wfMsg($x) ) ) {
$wgOut->addWikiText( wfMsg( $source ) );
}
return true;
}