Extension talk:MenuTabs

Latest comment: 17 years ago by Roc michael in topic Good for Mediawiki 1.10.1

Not working

edit

Doesnt work for me. I have mediawiki 1.5.4 (dont worry not on the internet) and php 4.3.10. What I get get is a bullet list instead of menu tabs. I have inserted the css to main.css as well. --202.1.192.199 19:36, 26 January 2006 (UTC)Reply

Which Browser

edit

Can you provide more details so I can improve this? Which browser were you using? I have tested with IE6 and FireFox 1.5 only so far. I have made some changes to the CSS on the Content Page so try cutting and pasting again. I am runng MW 1.5.6 on PHP 4.4.1, here is screenshot using the (slightly modified) MonoBook skin: RobertCastley 23:22, 26 January 2006 (UTC)Reply

I am using opera. With the modified version of CSS, now it works with opera too. Thanks --202.1.192.199 02:19, 27 January 2006 (UTC)Reply
Excellent, thanks for the feedback.--81.144.178.66 08:30, 27 January 2006 (UTC)Reply


When used as a template...

edit

When MenuTab syntax used inside a template, and when the template is used in an article that contains <pre></pre>, the content inside <pre> is replaced with something similar to UNIQ4cd10ef977a23b87-pred2da24b350873a500000001 ← This is variable...

Probably a mediawiki bug? --Oblivious 07:59, 30 January 2006 (UTC)Reply

Code fix for using Menutabs in Templates

edit

The code on the main page has been updated to fix the problem with using the tabs in templates --RobertCastley 12:33, 7 February 2006 (UTC)Reply

Thanks... was looking forward for this! --Oblivious 06:03, 12 February 2006 (UTC)Reply

Wrapping Menu Tabs

edit

I'm using MediaWiki 1.6.3 and your latest MenuTabs extension. I'm finding that the last tab is wrapping, as shown:

If I make the title of the last tab shorter (from "Electronic Design Automation" to just "EDA"), it does not wrap. Is there an implied length of the tabs before this occurs? Is there a way to change this?

Thanks. --Mgenovese 04:22, 13 April 2006 (UTC)Reply

You can adjust the width in the CSS i.e. change 45em to 55em.

- Robert

Change the link?

edit

This may be a very noob question but now the tabs link to the " edit" pages. What do you need to do make it link to the article ?

thx,

Answer: The page needs to exist first, if you are getting the edit function then I assume you are seeing an empty box which means no entry exists yet.

Follow Up: Problem Solved - In addition to the above Answer you should check your user preferences as I had the same problem which was resolved once I checked "Disable Page Caching" from the "Misc" tab on the "Preferences" page.

Using TinyMCE as wysiwyg editor causes the tab code to fail

edit

I'm basically seeing the code in a CODE window. What can i do to get around this?

Thanks.


Thanks!

edit

I wanted to thank you for creating MenuTabs! It works great and I've incorporated it into my wiki - see http://www.mathcasts.org -- Tim Fahlberg

RobertCastley Hehe! Cool, thanks for the feedback!

You're so welcome Robert! I just love MenuTabs and deeply appreciate your work on it! -- Tim Fahlberg

Question: Cool extension btw!. I was wondering how Tim can have the menu tab on each of his page with the correct tab highlighted? Do i have to include this <mantab></mantab> in every page that i create or is there a template i can add it to ? Thanks. -- Jon

Very cool Robert

edit

MenuTabs is great Robert, thanks for sharing. I have a suggestion: is it possible to make it so the main menu tab can stay highlighted when you go to a sub menu item, say, if, by having your main menu item addressed to "Office Manual" and the sub menu addressed to "Office Manual:example|example"? i.e. by using the colon the main menu tab, "Office Manual," and the sub menu tab, "example," would both be highlighted. -Christiaan 12:30, 25 July 2006 (UTC)Reply

</li>

edit

When i use Menutabs I get a text </li> extra for each menu/submenu item on te screen. I work with version 1.7.1 at my webserver. On my local PC I got 1.6.7 and it works great. Who can help? BB70 12:09, 28 July 2006 (UTC)Reply

Remove the occurances of "</li>" from lines 69, 71, 92. Tested so far with Firefox 1.0.4, IE 7, and Mozilla 1.7.7. --68.121.254.86 22:06, 2 August 2006 (UTC)Reply

RobertCastley Since the 1.7.x release came out with no real warning of PHP5 only support I am not able to test/fix MenuTabs. So like a lot of MediaWiki users out there I am unable to upgrade to the 1.7.x release as it will probably break other extensions I have installed and running. In my production Wiki I have GeshiHightlight, inputbox, wikicalendar, RSS and Freemind extensions and as they all use something similiar to MenuTabs I can only guess they will be broken too!

This seems like a great idea but as far as I can tell, the subtab always seems to be the same. It seems to me that there needs to be a way to have different sets of subtabs depending on which main tab has been selected. DavidJameson 13:48, 10 August 2006 (UTC)Reply

Subtabs?

edit

Shouldn't the submenu change based on the main tab position? What is the reason for a submenu if it is not dynamically changing based on the main tab click?

</li> fix

edit

MediaWiki Version 1.7.1

PHP Version 5.1.4

We ran into the same </li> problem as one of the previous posters. The fix was to change the location of the parsing inside the loop so that the url itself was parsed, but, the actual remaining html was not 'entified'.

Original code:

        foreach ($fields as $field) {
                if ($title == $field) {
                        $item .= "<li><span>$field</span></li>\n";
                } else {
                        $item .= "<li>$field</li>\n";
                }
        }
        $output = & $parser->parse($item, $wgTitle, $parserOptions);
        $linkoutput = $output->getText();
        return $prepend . $linkoutput;

Modified version:

        foreach ($fields as $field) {
          $url = & $parser->parse($field, $wgTitle, $parserOptions);
          $parsed_url = $url->getText();
                if ($title == $field) {
                        $linkoutput .= "<li><span>$parsed_url</span></li>\n";
                } else {
                        $linkoutput .= "<li>$parsed_url</li>\n";
                }
        }
        return $prepend . $linkoutput;

Also note that the subtab code had the same problem and is corrected in the complete new extension as displayed below.

Good for Mediawiki 1.10.1

edit

The code below here, not written by me, is good for Mediawiki 1.10.1. I'v tested it --Roc michael 15:57, 14 September 2007 (UTC)Reply

<?php
# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/MenuTabs.php");

$wgExtensionFunctions[] = "wfMenuTabs";

$wgExtensionCredits['other'][] = array(
'name' => 'MenuTabs',
'author' => 'Robert Castley',
'description' => 'allows for the creation of a menu navigation bar on each page if desired ');

function menuTabsCSS() {
        global $wgOut;
        $css = <<<eof
<style type="text/css">
#main { border-top: 1px solid #666; clear: both; width: 100%; }
#contents { background: #9aa4b3; border-top: 2em solid #e6f0ff; }
#header { position: relative; width: 100%; height: 2em; width: 45em; }
#header ul#primary { margin: 0; padding: 0; position: absolute; bottom: -1px; left: 20px; width: 45em; }
#header ul#primary li { display: inline; list-style: none; }
#header ul#primary a,#header ul#primary span,#header ul#primary a.current, #header ul#primary strong {
        width: auto; display: block; float: left; padding: 4px 0px; padding-left: 4px;
        padding-right: 4px; margin-top: 1px; margin-right: 2px; text-align: center; font-family: Arial;
        font-size: 85%; text-decoration: none; color: #333; }
#header ul#primary span,#header ul#primary a.current,#header ul#primary a.current:hover, #header ul#primary strong {
        border: 1px solid #666; border-bottom: none; background: #e6f0ff;
        padding-bottom: 6px; padding-left: 4px; padding-right: 4px; margin-top: 0; }
#header ul#primary a { background: #bbc8da; border: 1px solid #AAA; border-bottom: none; }
#header ul#primary a:hover { margin-top: 0; border-color: #666; background: #FFF7CD; padding-bottom: 5px; }
#header ul#secondary { position: absolute; margin: 0; padding: 0; bottom: -1.4em; left: 1px; width: 50em; }
#header ul#secondary li a,#header ul#secondary li span ,#header ul#secondary li strong {
        width: auto; display: block; float: left; padding: 0 5px;
        margin: 0; text-align: center; border: none; border-left: 1px dotted #AAA;
        background: none; }
#header ul#secondary li a { color: #06C; text-decoration: underline; }
#header ul#secondary li a:hover { color: #333; background: transparent; padding: 0 5px; border: none;
        border-left: 1px dotted #AAA; }
#header ul#secondary li a:active { color: #333; font-weight: normal; background: transparent; }
#header ul#secondary li:first-child a, #header ul#secondary li:first-child span { border: none; }
</style>
eof;
        $wgOut->addHTML($css);
}

function wfMenuTabs() {
        global $wgParser;
        menuTabsCSS();
        $wgParser->setHook( "maintab", "renderMainTab" );
        $wgParser->setHook( "subtab", "renderSubTab" );
}


function renderMainTab( $input ) {
        global $wgOut;
        global $wgTitle;
        global $wgRequest;
        global $wgUser;
        global $wgParser;
        $parserOptions = ParserOptions::newFromUser( $wgUser );
        $parser = & new Parser();
        $item = '';
        $title = $wgRequest->getVal( 'title' );
        $title = preg_replace("/_/", " ", $title);
        $fields = explode("||",$input);
        $prepend = "<div id=\"header\">\n";
        $prepend .= "<ul id=\"primary\">\n";
        foreach ($fields as $field) {
          $url = & $parser->parse($field, $wgTitle, $parserOptions);
          $parsed_url = $url->getText();
                if ($title == $field) {
                        $linkoutput .= "<li><span>$parsed_url</span></li>\n";
                } else {
                        $linkoutput .= "<li>$parsed_url</li>\n";
                }
        }
        return $prepend . $linkoutput;
}

function renderSubTab( $input ) {
        global $wgOut;
        global $wgTitle;
        global $wgRequest;
        global $wgUser;
        global $wgParser;
        $parserOptions = ParserOptions::newFromUser( $wgUser );
        $parser = & new Parser();
        $item2 = '';
        $fields2 = explode("||", $input);
        $prepend = "<ul id=\"secondary\">\n";
        foreach ($fields2 as $field2) {
          $url = & $parser->parse($field2, $wgTitle, $parserOptions);
          $parsed_url = $url->getText();
                if ($field2 != '') {
                        $linkoutput .= "<li>$parsed_url</li>\n";
                }
        }
        $append = "</ul>\n";
        $append .= "</ul>\n";
        $append .= "</div>\n";
        $append .= "<div id=\"main\">\n";
        $append .= "<div id=\"contents\"></div>\n";
        $append .= "</div>\n";
        return $prepend . $linkoutput . $append;
}
?>
This worked for me. - 129.94.6.30 07:33, 13 September 2006 (UTC)Reply
Worked for me too on 1.8.2. After waiting about 20 min for the session to time about so it could re-cache. Rune.
Also worked on MW 1.11.0--Roc michael 22:55, 8 November 2007 (UTC)Reply


Dynamic MenuTabs using DPL2?

edit

I think this is a really good extension, however there is one bit of extra funtionallity that would make it for me a great extension. Currently the tabs have to be statically defined either within the article, or in a template. If it could somehow be made to wok with the DynamicPageList2 extension, then we could do really cool stuff like:


Template:CategoryMenu

<maintab>
[[:Category:{{{1}}}]]||<DPL>category={{{1}}} mode=inline inlinetext=|| count=10 titlemaxlength=15</DPL>
</maintab>
<subtab>{{{2|}}}</subtab>

Thus allowing a set of dynamic tabs that will allow quick navigation between the pages of a given category. This would be extremely useful for categories with a relatively small number of members.

Currently when I try to implement the above code on my own wiki (MW 1.6.8), the <DPL>... </DPL> is taken literally, not evaluated. I've tried hacking the extensions together myself - adding a new 'mode' to DPL called menutabs which calls the renderMainTab function from MenuTabs.php, but my PHP knowledge is rather limited and I've yet to get this working properly. I'll keep trying for now, and will probably end up eventually with something that works, but is rather ugly. If anyone has any good ideas for how to better integrate these two extensions, please post here. --OneSeven 02:09, 4 October 2006 (UTC)Reply


BAD RENDERED WITH CAVENDISH SKIN

edit

I am running MediaWiki 1.9.2 with PHP 5.2 and MenuTabs works fine on Monobook but does not work right with Cavendish skin. First of all, after i added the include line to LocalSettings.php, the top bar of the cavendish skin gets squeezed. Besides, the MenuTabs themselves render very bad. Any solution?? --201.235.235.49 23:42, 4 March 2007 (UTC)Reply

usage with Mediawiki:Sitenotice

edit

Hi,

I've a problem. I tried to add MenuBar on each Mediawiki page. I've created a template - Template:TopMenu, then I have added it to Mediawiki:Sitenotice. Text put on this page is rendered on each MW page.

However there is a problem with the display of the elements that were chosen. Sometimes they're flat - i.e. it's not possible to click them even if I'm on the other page of the menu or even mediawiki. I'd be v.grateful for any help.

Regards, Aretai 10:48, 23 March 2007 (UTC)Reply

li problem in MW 1.10.1

edit

I have MW 1.10.1 and I get /li after every tab, Any suggestions, for change ?

=> try this.

Didn't work for me. I got the following error:
Notice: Undefined variable: linkoutput in /home/fandomin/public_html/extensions/MenuTabs.php on line 73
Notice: Undefined variable: linkoutput in /home/fandomin/public_html/extensions/MenuTabs.php on line 103

--User:Purplepopple,

How do I use the code from inside monobook.php template?

edit

I am new to Mediawiki (version 1.5.8 - inside Joomla as a Component = Mambowiki). I found your excellent template while trying to create a user navigation system - it's great, and just what everyday surfers need. What I want to do is put it into the Template above the page title but I can't find information on how to include the template call into the template itself. The MenuTabs template call works great inside each article but it does not look quite right. Can I call a MediaWiki "template" inside of monobook.php for example or is it not allowed? Also, how do I get a tab to show a category - if I put [[Category:Salsa| Salsa]] the tab is not shown. Only document links seem to be shown? 79.66.177.10 14:52, 17 September 2007 (UTC)Reply

implemention

edit

i didnt quite realize how to implement this extension, Do enter the code on the mediawiki:toolbar fro example or where ?

PHP Catchable fatal error: Argument 2 passed to Parser::parse() must be an instance of Title, null given, called in ./extensions/MenuTabs/MenuTabs.php

edit
  • Problem: On Mediawiki version 1.23.9 Mediawiki jobs (runJobs.php) and Semantic Mediawiki jobs (SMW_refreshData.php) crash with an error:
PHP Catchable fatal error:  Argument 2 passed to Parser::parse() must be an instance of Title, null given, called in ..../extensions/MenuTabs/MenuTabs.php on line 74 and defined in ./includes/parser/Parser.php on line 356
Return to "MenuTabs" page.