我有一个 PHP 脚本,它在我的 MediaWiki 上显示员工列表。我还有一个特殊页面,您可以在其中管理哪些用户是员工,效果很好。但是,当您在特殊页面上进行后端更改时,更改不会显示在 wikipage 上,它会在其中插入标签,直到您编辑该页面并且什么都不更改并保存之后。
这只能是因为我使用了错误的钩子。我试图改用这个钩子,但它似乎不起作用:http ://www.mediawiki.org/wiki/Manual:Hooks/ArticlePageDataBefore
现在我正在使用这个钩子。仅更改变量名称不起作用:
$wgHooks['ParserFirstCallInit'][] = 'wfEmployeesParserInit';
// Hook our callback function into the parser
function wfEmployeesParserInit( Parser $parser ) {
// When the parser sees the <sample> tag, it executes
// the wfEmployeesRender function (see below)
$parser->setHook( 'employees', 'wfEmployeesRender' );
// Always return true from this function. The return value does not denote
// success or otherwise have meaning - it just must always be true.
return true;
}
// Execute
function wfEmployeesRender( $input, array $args, Parser $parser, PPFrame $frame ) {
...