Customization:Quickbar

From Meta, a Wikimedia project coordination wiki
Important note: the instructions on this page may be out of date, incorrect, or unnecessary; for most requirements, the FAQ contains the necessary instructions. This page, however, explains some tasks not covered in the FAQ!

Editing Quickbar depends largely on how your skin is drawing the Quickbar. If you are looking for cosmetic enhancement, check section 1.1 or section 4 (depending on which Skin you're using). If you just want to add another link, check solution 1.2, 2 or 3 depending on Skin and Mediawiki version.

If you're using a standard Skin such as Standard/Nostalgia/CologneBlue[edit]

Changing the look and feel of the Quickbar[edit]

Under MediaWiki 1.3 wikistandard.css is under /stylesheets. Under MediaWiki 1.4 wikistandard.css is under /skins/common.

Editing wikistandard.css:[edit]

wikistandard.css allowed me to alter the font and the outer borders of the quickbar

  #quickbar{[edit in here];} 

Changing the makeup of the Quickbar[edit]

To do this edit the quickBar function in your skin class. This is most likely in /includes/skin.php

Editing Skin.php:[edit]

Skin.php allowed me to add borders (limited), images, text, links, and delete the dividers, etc.

       function quickBar()
	{
		global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
		global $wgDisableUploads, $wgRemoteUploads;
	    
		$fname =  'Skin::quickBar';
		wfProfileIn( $fname );

		$action = $wgRequest->getText( 'action' );
		$wpPreview = $wgRequest->getBool( 'wpPreview' );
		$tns=$wgTitle->getNamespace();

		$s = "\n<div id='quickbar'>" ;
		$s .= $this->logoText() ;
        
      ****** [edit in here - add/delete what you want and TEST] ******
        }

Unfortunately, in order to add what you want, you need to read the code and decipher what is already set. For example, I wanted to add a "quick links" link to the Quick Bar/Navigation Bar.

I added:

$s .= $sep . $nbsp . "<a href='\mediawiki\index.php\Quick_Links_Page'>Quick Links</a>";

And I added that just above the text:

$s .= $sep. $sep. $sep. $nbsp . $this->mainPageLink();

If you are editing the text, you should notice that:

 
                $sep = "\n<br />"; (adds a line-break)
		$s .= $sep;        (I think this prints 
                                    the line break just 
                                    defined)
                $nbsp = "&nbsp;";
   


The outcome of me adding this text to the Skin.php file was an internal link called "Quick Links" to a page entitled "Quick Links Page" within my personal wiki.... and the link was situated above the "Main Page" link with a blank line between the two.

I hope that helps.!!?

If you're using a SkinTemplate skin such as MonoBook under MediaWiki 1.6[edit]

from http://meta.wikimedia.org/wiki/Layout_customization#How_do_I_add_an_editable_Left_Menu.3F

you just need to edit MediaWiki:Sidebar, see the line in format of link|Display name

The Sidebar is located at http://<yourhost>/wiki/index.php/MediaWiki:Sidebar

If you're using a SkinTemplate skin such as MonoBook under MediaWiki 1.4[edit]

Changing the makeup of the Quickbar by altering $wgNavigationLinks[edit]

On #mediawiki IRC channel I saw question:

  • How can I add links to the navigation bar?

I know that I have read the solution somewhere, but I don't recall where (meta, mailing-list, en-wikipedia, wp.wikidev,...)

So I went the "hard" way :-)))

Note: Failures of the Quickbar messages to resolve have been noted by instability in the Turck Mmcache memory cache. If you have difficulty with this feature, consider disabling the option $wgUseTurckShm in LocalSettings.php

  1. Open includes/DefaultSettings.php, find the array named $wgNavigationLinks and copy it to LocalSettings.php. As of version 1.4 beta 5 this array has already been placed in LocalSettings.php. Remember: never edit DefaultSettings.php directly. Always make your changes in your own LocalSettings.php file.

LocalSettings.php:

  $wgNavigationLinks = array (
  	array( 'text'=>'mainpage', 'href'=>'mainpage' ),
        array( 'text'=>'COBENZL', 'href'=>'mylink-url' ) 
  	array( 'text'=>'portal', 'href'=>'portal-url' ),
  	array( 'text'=>'currentevents', 'href'=>'currentevents-url' ),
  	array( 'text'=>'mylink', 'href'=>'mylink-url' ),
  	array( 'text'=>'help', 'href'=>'helppage' ),
        array( 'text'=>'mylink', 'href'=>'mylink-url' ),
  	array( 'text'=>'sitesupport', 'href'=>'sitesupport-url' )
  );

In this array, insert a new line with the following contents:

  array( 'text'=>'mylink', 'href'=>'mylink-url' ) 

Click refresh on Main page and mylink should appear in the navigation bar. If it's not there you should disable caching in your preferences while you are testing.

Can you be more specific on what caching you're talking about and where/how to disable it?
You can force the cache to reload for just the page you are on by typing shift+ctrl+clicking 
on reload (instead of bothering to change your browser settings and change them back)

To populate the title and target of the link:

  1. Type in your browser's location bar http://WIKI_URL/MediaWiki:Mylink (where "WIKI_URL" is the address of your wiki, everything including "index.php?title=" but the article name). This will take you to a blank message page entitled MediaWiki:MyLink. Edit the page and enter the link name in the textbox. This is the title of the link as it should be shown in the Quickbar. E.g. "Info on monkeys". Now 'mylink' from above will be associated with the text "Info on monkeys".
  2. Type in your browser's location bar http://WIKI_URL/MediaWiki:Mylink-url (again, "WIKI_URL" is your wiki's address). This will take you to a blank message page entitled MediaWiki:MyLink-url. Edit the page and enter the link target in the textbox. The link target is the name of the page which the link should lead to. E.g. "Info_On_Monkeys". Now 'mylink-url' from above will be associated with the url "Info_On_Monkeys".

Alternatively you can define the targets in the language files[edit]

(this technique should only be necessary if you have "$wgUseDatabasesMessages=false" in LocalSettings.php (see Help:MediaWiki namespace; with the option set to true, the PHP files are used only as a fall-back for the pages in the database)

Language.php:

  'mylink' => 'Google',
  'mylink-url' => 'http://www.google.ch',

Internal links are similar, just don't write the http prefix.

You definitely shouldn't need to do this. I've used this feature myself and never had to edit language.php. Can you confirm that this is still require using a newly installed (with original language file) wiki?
This was just someones suggestion I moved from the Customization page. Its an alternative, which seems relevant when the link is language specific. Its just another way of editing the $wgNavigationLinks array. This page is referenced by Requests for new languages under the item starting Proposal Plans in this context.

If you're using a SkinPHPTal skin such as MonoBook under MediaWiki 1.3[edit]

Changing the makeup of the Quickbar by altering xhtml_slim.pt[edit]

You can add new links in the navigation bar in the /templates/xhtml_slim.pt add your link in the next section

   <div class="portlet" id="p-nav">
          <h5 i18n:translate="string:navigation">Navigation</h5>
          <div class="pBody">
            <ul>
              <li id="n-mainpage"><a href="${nav_urls/mainpage/href}"
                i18n:translate="string:mainpage">jitender</a></li>
              <li id="n-portal" tal:condition="nav_urls/portal/href"><a href="${nav_urls/portal/href}"
                i18n:translate="string:portal">Community Portal</a></li>
              <li id="n-currentevents" tal:condition="nav_urls/currentevents/href"><a href="${nav_urls/currentevents/href}"
                i18n:translate="string:currentevents">Current Events</a></li>
              <li id="n-recentchanges"><a href="${nav_urls/recentchanges/href}"
                i18n:translate="string:recentchanges">Recent Changes</a></li>
              <li id="n-randompage"><a href="${nav_urls/randompage/href}"
                i18n:translate="string:randompage">Random Page</a></li>
              <li id="n-help"><a href="${nav_urls/help/href}"
                i18n:translate="string:help">Help</a></li>
              <li id="n-sitesupport" tal:condition="nav_urls/sitesupport/href"><a href="${nav_urls/sitesupport/href}"
                i18n:translate="string:sitesupport">Donations</a></li>
            </ul>
          </div>

This is an link example that you can add:

 <li id="google"><a href="http://www.google.com">Google</a></li>


If you want to link to a page in the wiki, for example to an article called "Foo", you have to do some changes in source code. First, add your link to the xhtml_slim.pt, for example:

 <li id="n-foo"><a href="${nav_urls/foo/href}" i18n:translate="string:foo">Foo page</a></li>

Now you have to tell the software, what "foo" is. Open the SkinPHPTal.php located in the includes-directory and search for the function "buildNavUrls". You'll see some assignements to the "$nav_urls"-array. Add a line like the following:

 $nav_urls['foo'] = array('href' => htmlspecialchars( $this->makeI18nUrl('Foo')));

This tells the software, that the command "${nav_urls/foo/href}" above must point to an article called "foo".

Now the correct translation for "foo" is missing. Go to the languages-directory and open the languageXX.php. There you should find many assignments to an array called "$wgAllMessagesXX". Just add one:

 "foo" => "Foo page",


If the the new links won`t appear at the page, try to reload the page or delete the browser-cache.

Changing the look and feel of Quickbar if using a PHPTal type Skin such as MonoBook[edit]

This can be done by changing the portlet class in the stylesheet. This will be called main.css and it resides in the directory of the same name as the skin.

For example for MonoBook, the stylesheet is /stylesheets/monobook/main.css under MediaWiki 1.3 or /skins/monobook/main.css under MediaWiki 1.4

Editing main.css[edit]

The default style for portlets is

.portlet {
    border: none;
    margin: 0 0 0.5em 0em;
    float: none;
    padding: 0;
    width: 11.6em;
    overflow: hidden;
}

The bodytext inside the portlet is defined by

.pBody {
    font-size: 95%;
    background: White;
    border-collapse: collapse;
    border: 1px solid #aaaaaa;
    padding: 0 0.8em 0.3em 0.5em;
}

Return to Customization