[Mediawiki-l] Display Underscore On Title Display

K. Fairchild kfairchild at stenbarr.com
Wed Jul 5 20:02:54 UTC 2006


Wonderful, iubito.  That's exactly what I needed.  Thanks!




Date: Wed, 5 Jul 2006 18:11:15 +0200
From: iubito <iubito at gmail.com>

>>>
You can create a simple extension which is a hook.

Copy/paste this code in a new php script (e.g. getPageTitle.php) in
extensions directory.

<?php
$wgHooks['GetPageTitle'][] = 'nicePageTitle';

function nicePageTitle($pagetitle) {
#TEST : $pagetitle = strtoupper($pagetitle);
   $pagetitle = str_replace(' ', '_', $pagetitle); } ?>

and in your LocalSettings.php add near the end
include('extensions/getPageTitle.php');

In includes/OutputPage.php, locate the function getPageTitle in
OutputPage class.
Replace it by :

function getPageTitle() {
  wfRunHooks( 'GetPageTitle', array(&$this->mPagetitle ));
  return $this->mPagetitle;
}

Works on my MW 1.6.7
<<<






More information about the MediaWiki-l mailing list