Hi,
i'm writing a Specialpage named Languages (Special:Languages) to display
some information from language table (multilingual)
but i got a problem, the data is shown twice and also in any special page
this information is shown.
in LocalSettings.php file i have added a line (at the end of the file) like
this: require_once('extensions/SpecialLanguages.php');
and the code in extensions/SpecialLanguages.php file is:
if (!defined('MEDIAWIKI')) die();
$wgExtensionFunctions[] = "wfSpecialLanguages";
function wfSpecialLanguages() {
$mlmw = new MLMWLanguages();
$mlmw->execute();
}
class MLMWLanguages {
function MLMWLanguages() {
SpecialPage::addPage(new SpecialPage('Languages'));
}
function execute() {
global $wgMessageCache, $wgOut;
$wgMessageCache->addMessages( array( 'languages' =>
'Languages Supported by this Wiki'));
$dbr =& wfGetDB( DB_SLAVE );
$res = $dbr->select(array('language'),
array('language_id', 'english_name',
'native_name', 'iso639_2', 'iso639_3', 'wikimedia_key',
'dialect_of_lid'),
array('is_enabled' => '1'),
'Languages:wfSpecialLanguages', array('ORDER BY' =>
'english_name'));
if ( false !== $res ) {
if ( $dbr->numRows( $res ) ) {
$wgOut->addHTML("<table border=1
cellspacing=0>");
$wgOut->addHTML("<tr><th>English
name</th><th>Native name</th><th>ISO
639_2</th><th>ISO
639_3</th><th>Wikimedia key</th><th>Dialect of
lid</th</tr>");
while ( $row = $dbr->fetchObject(
$res ) ) {
$wgOut->addHTML("<tr><td>" .
ucfirst(strtolower($row->english_name)) . "</td><td>"
.ucfirst(strtolower($row->native_name)) . "</td><td
align=center>{$row->iso639_2}</td><td
align=center>{$row->iso639_3}</td><td
align=center>{$row->wikimedia_key}</td><td
align=center>{$row->dialect_of_lid}</td></tr>");
}
$wgOut->addHTML("</table>");
}
}
}
}
do you have any idea why i get 2 the html code? here is the link of my
development server where you can see what i am talking about
http://mlmw.pastorelly.net/index.php/Special:Languages
thanks in advance
--
regards,
grace