[Mediawiki-l] Help in setting a special page

noname uwmtsm at gmail.com
Mon Apr 7 23:39:45 UTC 2008


Dear all,

I am using MediaWiki 1.12.0 and I am trying to set up a special page
I used the instructions from
http://www.mediawiki.org/wiki/Writing_a_new_special_page

Name of my page is Gauss

my Guass.php file is like 

<?php
# Alert the user that this is not a valid entry point to MediaWiki if
they try to access the skin file directly.
if (!defined('MEDIAWIKI')) {
        echo <<<EOT
To install my extension, put the following line in LocalSettings.php:
require_once( "$IP/extensions/Gauss/Gauss.php" );
EOT;
        exit( 1 );
}
 
$dir = dirname(__FILE__) . '/';
 
$wgAutoloadClasses['Gauss'] = $dir . 'Gauss_body.php'; # Tell MediaWiki
to load the extension body.
$wgExtensionMessagesFiles['Gauss'] = $dir . 'Gauss.i18n.php';
$wgSpecialPages['Gauss'] = 'Gauss'; # Let MediaWiki know about your new
special page.
$wgHooks['LanguageGetSpecialPageAliases'][] = 'Gauss'; # Add any aliases
for the special page.
 
function Gauss(&$specialPageArray, $code) {
  # The localized title of the special page is among the messages of the
extension:
  wfLoadExtensionMessages('Gauss');
  $text = wfMsg('Gauss');
 
  # Convert from title in text form to DBKey and put it into the alias
array:
  $title = Title::newFromText($text,'Special');
  $specialPageArray['Gauss'][] = $title->getDBKey();
 
  return true;
}

My Gauss.i18n.php is 


<?php
$messages = array();
$messages['en'] = array(
        'Gauss' => 'Gauss'
        );


My Gauss_body.php is

<?php
function efRunGauss( $par ) {
    Gauss::run( $par );
}

class Gauss extends SpecialPage {
        function Gauss() {
                SpecialPage::SpecialPage("Gauss", '', true,
'efRunGauss');
                wfLoadExtensionMessages('Gauss');
        }

        function run( $par ) {
                # Do stuff
                # ...
        }
}


I have added the following entry to LocalSettings.php

require_once("extensions/Gauss/Gauss.php");

But when I open my wiki home page 
it gives an error 

Fatal error: Call to a member function getDBKey() on a non-object
in /var/www/html/mtsmwiki/extensions/Gauss/Gauss.php on line 25

I have no idea how to get rid of this error. 
I will appreciate any help in this regard. Thanks in advance

-Mike




More information about the MediaWiki-l mailing list