[Mediawiki-l] Help with "Hello World" extension

Alok Watve alok.watve at gmail.com
Sat Jul 31 00:08:41 UTC 2010


Hi,

I am trying to write the simplest extension using a parser function
(to get the feel of it). My extension is supposed to greet anyone who
uses it. I am using this wikipage (
http://www.mediawiki.org/wiki/Manual:Parser_functions) as the
reference
However, I am unable to get even this simplest extension to work. Can
anyone help me fix this. I am quite lost.

Any help will be greatly appreciated.

Thanks,
Alok

This is what I have in my LocalSettings.php

#################### Say Hello Extensions ############################
require_once( "$IP/extensions/sayHello.php");
#################### End of exension ################################


And here is the file $IP/extensions/sayHello.php

<?php
// Is this the right entry point ?
if ( !defined( 'MEDIAWIKI' ) )
{
    die( 'Not an entry point.' );
}

global $wgExtensionFunctions;  // I dont know if this is needed. I
could not find a clear description about it.
global $wgExtensionCredits;      // Same as above.... I am doing this
out of desperation to make this work
$wgExtensionFunctions[] = 'wfSayHello'
$wgExtensionCredits['SayHello'][] = array(
    'name' => 'SayHello',
    'author' => 'Alok',
    'url' => '',
    'description' => 'Extension that greets user',
    'descriptionmsg' => 'This is a test extension',
    'version' => '1.0.0',
);

global $wgHooks
$wgHooks['SayHello'][] = "wfSayHello";

global $wgParser;
$wgParser->setFunctionHook('SayHello', 'wfSayHello');

function wfSayHello($parser, $userNameInput)
{
    return  "Hello " . $userNameInput;
}
return true;
?>



More information about the MediaWiki-l mailing list