问题
Using Mediawiki 1.19 and want to add tabs with external links right next to the tab buttons 'Page' and 'Discussion'. How to do it?
- Extension:DynamicTabs does not work because it has trouble with vector skins.
- Steps in FAQ: How do I add/remove tabs throughout my wiki? do not have any effect at all.
回答1:
The code in the FAQ was outdated. For newer versions of MediaWiki, you have to use the SkinTemplateNavigation hook instead of the SkinTemplateContentActions hook. I updated the FAQ. Basically, you need to do something like this:
$wgHooks['SkinTemplateNavigation'][] = 'replaceTabs';
function replaceTabs( $skin, &$links) {
$links['namespaces']['name_of_tab'] = array(
'class' => false or 'selected', // if the tab should be highlighted
'text' => 'text_of_tab', // what the tab says
'href' => 'url_to_point_to', // where it links to
'context' => 'main',
);
return true;
}
来源:https://stackoverflow.com/questions/12192641/how-to-add-custom-tab-button-with-external-link