Extension:WETitle

Use of this extension is deprecated. Please use the DISPLAYTITLE magic word directly or the ShortTitle or MyTitle convenience templates.

What does this extension do?
The WETitle extension allows the page author to control the displayed title on a page, either limiting it to the subpage name or substituting their own complete title.

Usage

 * sets the displayed title to just the subpage name.
 * sets the displayed title to New Displayed Title.

Installation

 * @licence GPL2

if( !defined( 'MEDIAWIKI' ) ) { die( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); }

$wgExtensionCredits['parserhook'][] = array(       'name'           => 'WETitle',        'version'        => '0.2',        'url'            => 'http://WikiEducator.org/Extension:WETitle',        'author'         => 'Jim Tittsler',        'description'    => 'Allow changing the displayed title of a page', );

$wgHooks['LanguageGetMagic'][] = 'wfWETWikiWords'; function wfWETWikiWords(&$magicWords, &$langID) { # mark all case variations as the same $magicWords['wetitle'] = array(0, 'wetitle');

return true; }

$wgExtensionFunctions[] = 'wfWETParserFunction_Setup'; function wfWETParserFunction_Setup { global $wgParser; $wgParser->setFunctionHook( 'wetitle', 'wfWETParserFunction'); }

$wgHooks['ParserGetVariableValueSwitch'][] = 'wfWEAssignAValue'; function wfWETParserFunction(&$parser, $param) { $title = trim($param); # if no title is supplied, use subpage name if ($param == '') { $title = $parser->mTitle->getSubpageText; } $parser->mOutput->setDisplayTitle($title); $parser->disableCache; return ''; }