== in includes/SpecialPage.php ==
'Math' => new IncludableSpecialPage( 'Math' ),
== in includes/SpecialMath.php ==
<?php
/**
* @package MediaWiki
* @subpackage SpecialPage
*/
/**
* Entry point : initialise variables and call subfunctions.
* @param string $par Becomes "FOO" when called like Special:Math/op,a,b
(default NULL)
*/
function wfSpecialMath( $par=NULL, $specialPage ) {
global $indexMaxperpage, $toplevelMaxperpage, $wgRequest, $wgOut,
$wgContLang;
# Config
$indexMaxperpage = 960;
$toplevelMaxperpage = 50;
# GET values
$oprnd_a = $wgRequest->getVal( 'a' );
$oprnd_b = $wgRequest->getInt( 'b' );
$oprtr = $wgRequest->getInt( 'op' );
if( $par ) {
list( $oprtr, $oprnd_a, $oprnd_b ) = explode( ",", $par, 3 );
}
switch( $oprtr ) {
case "add":
$result = $oprnd_a + $oprnd_b;
break;
case "sub":
case "subtract":
$result = $oprnd_a - $oprnd_b;
break;
case "mlt":
case "multiply":
$result = $oprnd_a * $oprnd_b;
break;
case "div":
case "divide":
$result = $oprnd_a * $oprnd_b;
break;
}
if( isset($result) ) {
//$wgOut->setArticleBodyOnly( true );
$wgOut->addHtml( $result );
}
}
== Problem ==
Why does this produce "<p>5</p>" instead of "5" when
included in a page
like so:
{{Special:Math/add,2,3}}
Aron
Show replies by date