Hi my problem is that i cant load some javascript file @ my special page extension.
I tried it with addscript and some other methods but the only thing what happened was that the javascript was canceled cause no-js of the mediawiki software.
In the folder of my extension is a new.js file which i want to have access only on my special page.
Here is some code (most of it of the example of the special pages).
MyExentions.php
<?php
if (!defined('MEDIAWIKI')) {
echo <<<EOT
To install my extension, put the following line in LocalSettings.php:
require_once( "$IP/extensions/MyExtension/MyExtension.php" );
EOT;
exit( 1 );
}
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => '-',
'author' => 'Thomas D?ring',
'descriptionmsg' => '-',
'version' => '0.0.1',
);
$dir = dirname(__FILE__) . '/';
$wgAutoloadClasses['SpecialMyExtension'] = $dir . 'SpecialMyExtension.php';
$wgExtensionMessagesFiles['MyExtension'] = $dir . 'MyExtension.i18n.php';
$wgExtensionMessagesFiles['MyExtensionAlias'] = $dir . 'MyExtension.alias.php';
$wgSpecialPages['MyExtension'] = 'SpecialMyExtension';
SpecialMyExtension.php
<?php
class SpecialMyExtension extends SpecialPage {
function __construct() {
parent::__construct( 'MyExtension' );
}
function execute( $par ) {
$request = $this->getRequest();
$output = $this->getOutput();
$this->setHeaders();
# Get request data from, e.g.
$param = $request->getText('param');
# Do stuff
# ...
if(file_exists("extensions/TimeLine/TimeLine/data.xml"))
{
$data = simplexml_load_file("extensions/TimeLine/TimeLine/data.xml");
foreach($data->event as $event)
{
$html.="<tr><td>".$event['title']."</td><td>".$event['start']."</td></tr>";
}
$html.="</table>";
$html.="<a href="javascript:hello()">klick</a>";
$output->addHTML($html);
}
else
{
$wikitext = 'Datei nicht gefunden!';
$output->addWikiText( $wikitext );
}
}
}
?>
I hope you can help me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…