如何添加带有外部链接的自定义选项卡按钮? [英] How to add custom tab button with external link?

查看:133
本文介绍了如何添加带有外部链接的自定义选项卡按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Mediawiki 1.19,并希望在选项卡按钮页面"和讨论"旁边添加带有外部链接的选项卡.怎么做?

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.

推荐答案

常见问题解答中的代码已过时.对于MediaWiki的较新版本,您必须使用 SkinTemplateNavigation 钩子代替 SkinTemplateContentActions 挂钩.我更新了常见问题解答.基本上,您需要执行以下操作:

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;
}

这篇关于如何添加带有外部链接的自定义选项卡按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆