Extension:Tab0

From MediaWiki.org

Jump to: navigation, search

         

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
0 Tab

Release status: stable

Implementation  User interface
Description Adds "0" tab, linking to the edit page of the first section of the page
Author(s)  Agbad
MediaWiki  1.11, 1.12 and (likely) lower
License GPL-2+
Download Download

check usage (experimental)

This extension adds new tab, and the tab's name is "0". If you click on the "0" tab, then it open the edit page of the first part in the page.

[edit] Download

  1. Download the directory
  2. Add that line to LocalSettings.php to load that extension:
require_once( '$IP/extensions/Tab0/Tab0.php' );

[edit] Code

The code is of Tab0.php:

<?php
/** 
* @addtogroup Extensions 
*/
$wgExtensionCredits['other'][] = array(
    'name' => 'Tab0',
    'author' => 'Agbad',
    'description' => 'Adds "0" tab, linking to the edit page of the first section of the page',
    'descriptionmsg' => 'tab0-desc',    'svn-date' => '$LastChangedDate$',
    'svn-revision' => '$LastChangedRevision$',
    'url' => 'http://www.mediawiki.org/wiki/Extension:Tab0',
);
$wgExtensionMessagesFiles['Tab0'] = dirname( __FILE__ ) . '/Tab0.i18n.php';
$wgHooks['SkinTemplateContentActions'][] = 'showTab0';
function showTab0( $content_actions ) {
    global $wgTitle;
    if( $wgTitle->quickUserCan( 'edit' ) && $wgTitle->exists() ) {
        $content_actions['0'] = array(
            'class' => false,
            'text' => '0',
            'href' => $wgTitle->getFullURL( 'action=edit&section=0' ),
        );    
    }    
    return true;
}