Extension talk:CSS MenuSidebar

From MediaWiki.org
Jump to navigation Jump to search

Submenus hidden under main content area[edit]

1.The Sub-Menu in the Menu of the sidebar hide under the page how to bring them on top?

I think that should only happen on IE 6 and I haven't figured out how to fix it yet! Try playing around with z-index in the css. The page (or content) has z-index: 2;
--W.stoettinger 21:42, 28 July 2009 (UTC)
With a default MediaWiki and CSS MenuSidebar, I've attempted changing the z-index for both the CSS for the Sidebar and Monobook and it still shows up behind the context. Also, how would I be able to move it up the list?
--Insydius 19:26, 30 January 2010 (UTC)


  • MenuSidebar
  • /

/* this has to be overridden for every menu */

  1. p-Menu, #p-Menu_1, #p-Menu_2, #p-Menu_3 {

overflow: visible; }

Amend the css as above to make the example work

- 11:14, 19 February 2010 (UTC)

2.Is it possible to shrink toolbox into a menu?

This is not possible yet.
--W.stoettinger 21:42, 28 July 2009 (UTC)

One Solution[edit]

You can avoid submenus being cut off by the edge of the sidebar area with these adjustments (monobook and vector respectively):


/* Allow popup submenus to overflow the sidebar area for the Monobook skin */
.portlet {
	overflow: visible !important;


/* Allow popup submenus to overflow the sidebar area for the Vector skin */
#mw-panel div.portal div.body ul li {
	overflow: visible !important;
/* Positioning tweak for submenus specific to vector */
.menuSidebar ul div { 
        top: -1px !important; /* vertical offset of submenus */

--Tlosk 21:21, 23 October 2010 (UTC)

Instructions need clarification[edit]

I don't quite understand the instructions.

What must the css be renamed to? I have installed this extension but menus in the sidebar still show up as normal (nested) lists and do not do the popout. I am naming the menu the same as the test css (Menu), but it doesn't work. How must I structure and name the Mediawiki:Sidebar list that I wish to do the CSS popup?

As an example, I did the default install, and then am trying something like:

  • Menu
    • Item1
    • Item2
    • Item3

But they just show up normally in the Sidebar.

Clarification ²[edit]

I don't get that CSS part either.

I tried every possible name, changed my sidebar and CSS countless time, but couldn't get it to work.

Clarification would be more than welcome please, this looks like a fantastic extension! -- 09:20, 27 August 2009 (UTC)

Yeh the instructions are a bit unclear for me, and my results are promising, but not good. First, what I did. Install the extension to the extensions/ directory, added the require_once into LocalSettings.php, added the css into Mediawiki:Common.css with changes to the following bits:
<!-- Added 2010-06-23 from http://www.mediawiki.org/wiki/Extension:CSS_MenuSidebar -->
* MenuSidebar
/* this has to be overridden for every menu */
#p-Menu3 {
 overflow: visible; 
/* this has to be overridden for every menu */
#p-Shortcuts div,
#p-Menu2 div,
#p-Menu3 div {
 margin: 0;
 padding: 0;

and in Mediawiki:MenuSidebar added

* Shortcuts
** [[linkA]]
** GreatMenu
*** [[Main Page]]
*** [[linkB]]
This is the relevant bit of the html produced by the main page:
<!-- Shortcuts -->
<div class="portal" id='p-Shortcuts' >
	<h5 >Shortcuts</h5>
	<div class="body" >
            <div class="menuSidebar" >
                <ul >
                    <li class="item1 odd" ><a href="{URL}" title="{PAGE}" >linkA</a></li><li class="item2 even" ><a >GreatMenu<em >></em></a>

                <div ><ul >
                    <li class="item1 odd" ><a ><strong class="selflink" >Main Page</strong></a></li><li class="item2 even" ><a href="{URL}" class="new" title="linkB (page does not exist)" >BMT ARGOSS</a></li>


<!-- /Shortcuts -->
where I've replaced some of the actual names with {}'s. And of course, I used forced refreshes with any changes. Problem is, in Firefox 3.6.6, hovering over "GreatMenu" changes the background colour but does not display the menu list. I briefly tested it in IE in WinXP (sorry, didn't check the version), and the menu does pop out but only if you hover over a sliver at the right end of the "GreatMenu" box area. I needed to jump across to the menu very quickly or it would vanish, but once "on" the menu, it it functioned well. So in both cases, not usable. Anyone have any ideas, suggestions/requests for tests or further information? Hoogs 14:02, 1 July 2010 (UTC)

An error[edit]

I have an error after installation this extension:

"Undefined variable: lines in /var/www/mediawiki/site/extensions/MenuSidebar/MenuSidebar.php on line 46

Why it has occurred? What will advise?

Getting the same error... Sidebar not working... line 46 = if ($lines && count($lines) > 0) { - please help 21/06/2011Vadra

Font Size decreases with each nesting in Vector[edit]

Because vector uses a font size modifier that's less than one, each nested menu's font is smaller than its parent menu. If you use 3 or 4 sub-menus the font can get so tiny you can't read it. You can change the default value of 0.75em to a fixed size font or to a value closer to 1. For example putting this in Mediawiki:Vector.css will keep the font from shrinking with each nesting:

/* keeps nested list font sizes from continually decreasing with each nesting */
#mw-panel div.portal div.body ul li {
	font-size: small !important;

Change the arrow symbol for submenu[edit]

If you don't like the look of the > sign used to indicate a submenu you can change it to something else more to your liking. Open MenuSidebar.php in wiki/extensions/MenuSidebar and look for the part that says:

$content = substr($content,0,-4) . "<em>&gt;</em></a>"; 

and replace the &gt; (greater than symbol) code with one of your choosing. I think &rsaquo;&rsaquo; looks nice myself.--Tlosk 13:18, 24 October 2010 (UTC)


This extension is useful, but has some problems :

How to place the MenuSidebar on the top ?

3 Oct 2012

Using Vector skin and MenuSidebar -- edited MediaWiki:Sidebar to single menu entry preceded by double slashes (//*TOOLBOX).

This moved the Toolbox underneath MenuSidebar for my case.

In the code :

this is an example to make the list of the second entry bigger e.g. when ther is a longer text in a list item

but this doesn't work.

And when there is a big list of items, a part of the list goes out the screen, at the bottom.

It seems to need some improvments to be really utilisable.

MediaWiki version 1.16.x[edit]

Please see:

It says it is using this extension. The MediaWiki version currently listed on that page is 1.16.1. It is using the Vector skin as the default skin. I can see that by looking at the HTML source for any page on that wiki, and I find this:

var skin="vector"

It looks like the extension is working with the monobook skin too:

I edited the Extension:CSS MenuSidebar page to remove this:

doesn't work with 1.16

Should 1.16.1 be added to the top-right infobox?

See also: Forum:Sidebar Menus working now. CSS MenuSidebar updated for MediaWiki 1.16.x and Vector skin. --Timeshifter 02:44, 3 February 2011 (UTC)

Cell Size[edit]

Is there a way to make the "fly-over" cells a big longer in length? It is autowrapping, but would prefer to have it iether 1) autosize length, or 2) i can specify length.

btw; I have a Successful implementation of the script with the Vector.css and UsabilityInitiative (collapsible menu's) on mediawiki version 1.16.2
example Lynxpedia <-- Defunct, Site no longer available Lynxcub 01:20, 18 August 2011 (UTC)
helpful information. If you use the Dynamic (true) aspects and use the double brackets, it allows the MenuSidebar to be functional on iOS devices. --Lynxcub 19:50, 7 April 2011 (UTC)
Are you using the extension, or only CSS? Special:Version is blank:
http://lynxcub.podzone.net/mywikipedia/index.php/Special:Version -- <-- Defunct, Site no longer available Lynxcub 01:20, 18 August 2011 (UTC) Timeshifter 07:24, 28 April 2011 (UTC)
Special:Version is fixed (this is my sandbox wiki for my company)
Using this extension Lynxcub 16:30, 28 April 2011 (UTC)

Special:Version is blank[edit]

This extension works great, but when you go to Special:Version, it brings up a blank page. If I disable the call in localsettings.php to menusidebar.php the Special:Version comes back. Any help resolving this issue?

  • Found the answer out, from MenuSidebar.php, I changed line 21: Orig: 'author' => 'Wolfgang Stöttinger', to 'author' => 'Wolfgang Stottinger'. Took out the "o" with the double dots

Lynxcub 01:21, 16 April 2011 (UTC)

Thanks for that find, Lynxcub . We upgraded our version of PHP, and our Special:Version became blank. This helped me by changing Peter Strömberg's name to Peter Stromberg, and fixed the prob. -- 22:14, 17 August 2011 (UTC)

Additional code for nested hover menus[edit]

I consolidated some info here:

Right to left MW[edit]

Is there a simple way to make this extension work with right to left wikis (hebrew in my case)? 08:04, 6 July 2011 (UTC)

PHP accelerator compatibility[edit]

Is this extension known to cause problems with PHP accelerators? I've installed one in my wiki (MW 1.18), and a lot of the times the menu side bar is not loaded with the proper javascript and css, so that the entire link tree is displayed. When I removed the accelerator, everything worked find again. Osishkin (talk) 09:16, 8 April 2012 (UTC)

        ---I have not seen any issues using APC on mw1.19. --Teststudent (talk) 22:05, 29 May 2012 (UTC)

Error on 1.29.0[edit]

PHP Fatal error: Call to undefined method Revision::getRawText() in .../w/extensions/MenuSidebar/MenuSidebar.php on line 44

Need help :( — Preceding unsigned comment added by (talkcontribs)

Same, anyone know if this will ever be updated? — Preceding unsigned comment added by (talkcontribs)

  • I am not familiar with this extension or its implementation, but according to migration advice, fixing that should be a matter of changing line 44 from:
		$lines = explode("\n", $rev->getRawText());


		$lines = explode( "\n", ContentHandler::getContentText( $rev->getContent( Revision::RAW ) ) );

Given that that API call was deprecated in 1.21, there may be other issues as well though. --Clump (talk) 14:06, 31 December 2018 (UTC)

Error on 1.31.1[edit]

Can someone here help? I've upgraded my wiki from 1.26.3 -> 1.31.1 and now this Extension doesn't work. It has been a great extension and I would like to find a way to get this one to work in 1.31 (all the others Sidebar-related extensions I've just found too complicated). Here is the error:

Call to undefined function wfProfileIn() in /var/www/vhosts/<URL/COMPANY>/wiki/extensions/MenuSidebar/MenuSidebar.php:37 Stack trace: #0 /var/www/vhosts/<URL/COMPANY>/wiki/includes/Hooks.php(177): fnMenuSidebar(Object(SkinVector), Array) #1 /var/www/vhosts/<URL/COMPANY>/wiki/includes/Hooks.php(205): Hooks::callHook('SkinBuildSideba...', Array, Array, NULL) #2 /var/www/vhosts/<URL/COMPANY>/wiki/includes/skins/Skin.php(1262): Hooks::run('SkinBuildSideba...', Array) #3 /var/www/vhosts/<URL/COMPANY>/wiki/includes/skins/Skin.php(1287): Skin->{closure}() #4 /var/www/vhosts/<URL/COMPANY>/wiki/includes/skins/SkinTemplate.php(481): Skin->buildSidebar() #5 /var/www/vhosts/<URL/COMPANY>/wiki/includes/skins/SkinTemplate.php(249): SkinTemplate->prepareQuickTemplate() #6 /var/www/vhosts/<URL/COMPANY>/wiki/includes/OutputPage.php(2388): SkinTemplate->outputPage() #7 /var/www/vhosts/<URL> in /var/www/vhosts/<URL/COMPANY>/wiki/extensions/MenuSidebar/MenuSidebar.php on line 37

It looks like it is calling a removed function: wfProfileIn(). This was depreciated and then removed in the versions between 1.26 and 1.31.
Try commenting out this line:
wfProfileIn( __METHOD__ ); Nirobbins (talk)
I updated the code on the page to replace depreciated elements. This updated version works on my MW 1.31 installation. Nirobbins (talk)

Malfunction on 1.31.2[edit]

I recently updated this wiki here from MW 1.27.17 to 1.31.2. There I use a somewhat modified version of this extension, so that there can be displayed not only text elements as menu item but also an icon in addition to the text element. Every menu item with icon and text element is wrapped in a tiny wiki text created table which comes from MediaWiki:MenuSidebar and is then parsed by this extension. I struggled with the parser's output. Here are the two relevant lines from the fnBuildList function:

$text = $wgParser->parse(trim($line, '* '),$wgTitle,$opt,true,true)->getText();
$text = substr(trim($text),3,-5); // removes <p> and \n</p> that is generated by the parser

Since the parser seems to give back everything wrapped in a <div class="mw-parser-output"></div> tag, the parsed tiny table was shown in the menu tree. But because of the missing mw-parser-output class in the Common.css (???) only blank tables without icons and text elements were displayed. I altered the second line from the above-mentioned two lines to this, so that the above-mentioned tag is trimmed. This brought back a proper displayed menu tree:

$text = substr(trim($text),30,-6); // removes <div class="mw-parser-output"> and </div> that is generated by the parser

--Wgkderdicke (talk) 09:06, 15 June 2019 (UTC)

Error on 1.31.6[edit]

Fatal error: Uncaught Error: Call to a member function getContent() on null --Cjuni (talk) 20:58, 18 March 2020 (UTC)