说到在mediawiki的页脚增加链接
最常见的是要增加备案号的情况
网上比较流行的是在LocalSettings.php
里增加以下代码块
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function($sk, &$tpl){
$tpl->set('ICP_Number',Linker::makeExternalLink(
'http://beian.miit.gov.cn/','萌ICP备7355608号-1'
));
$tpl->data['footerlinks']['places'][]='ICP_Number';
return true;
};
但是查阅 Manual:Hooks/SkinTemplateOutputPageBeforeExec 就会看到一条警示说已经不推荐使用了
This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version 1.35.0.
同时也指明了新的钩子SkinAddFooterLinks
Warning: If you can avoid using this hook, please do. Seek more specific hooks such as Manual:Hooks/SkinAddFooterLinks wherever you can.
后来在邮件列表里找到一段能用的新式代码
$wgHooks['SkinAddFooterLinks'][] = function( $skin, $key, &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test1'] = '<a href=#>Test Link1</a>';
$footerlinks['test2'] = '<a href=#>Test Link2</a>';
}
};