Extension talk:TreeAndMenu

Doesn't work for me at all
I've added the include code to my LocalSettings.php file, and put the latest Treeview.php into my "wiki/extensions" directory, and it simply prints my code out verbatim, without even trying to produce the tree view, i.e.

I know it's finding the Treeview.php file correctly, though, because if the file is not present it complains a lot. Sorry, I have no idea about mediawiki extensions or how to debug them. I just followed the instructions as best I could and it just ignored my attempt at making a tree. 217.42.127.214 20:07, 28 August 2007 (UTC)
 * When the code gets printed like that it usually means you've missed out the php delimteres (&lt;? and ?&gt;) --Nad 20:22, 28 August 2007 (UTC)
 * Sorry, I don't understand. I have the <? ?> delimiters in my treeview.php file and my LocalSettings.php file, (except there it starts with "<?php").  I just copied the treeview.php exactly as it's given here in the wiki.  Do you mean that I have to include those delimiters within the wiki code as well? 158.125.1.113 16:07, 30 August 2007 (UTC)
 * No if you've copied the code exactly and have the delimiters it must be another problem. I think I misunderstood your problem - when you say it's "print out the code" I thought you mean the treeview's php code, but you're meaning the wikitext as shown above right? that's a different problem, what version of MediaWiki are you running? does the extension show up the the special:version page? --Nad 20:41, 30 August 2007 (UTC)

Eerror messages
I've tried to install it on my wiki but i get a lot of errors when i make a tree-entry on a page. (the tree is properly displayed!) The error messages are similar to this:
 * Notice: Use of undefined constant wgUser - assumed 'wgUser' in /var/www/html/wikidelfia/extensions/Treeview3.php on line 59

In the localsettings I put : include_once('extensions/treeview3.php') and the $wgTreeViewImages = array( with the proper links to the images. What is going wrong? --BB70 11:28, 14 March 2007 (UTC)
 * I know what that is - that's a setting in your php.ini that doesn't allow the array indexes to have their quotes missing - just put quotes around all the arrays, or download again - I've change the code to not depend on that setting now (I think I got them all, here's the diff). --Nad 23:19, 14 March 2007 (UTC)
 * It helps a little.. but i still get errors like: Notice: Undefined index: doc in /var/www/html/wikidelfia/extensions/Treeview3.php on line 84 (same for line 79 till 83) and these two: Notice: Undefined index: openlevels in /var/www/html/wikidelfia/extensions/Treeview3.php on line 85 ; Notice: Undefined offset: 5 in /var/www/html/wikidelfia/extensions/Treeview3.php on line 93. And there is a pop-up box with the message [object error] --BB70 07:42, 16 March 2007 (UTC)
 * You have your settings set extrememly strictly for it not to allow reading uninitialised variables and indexes! Check if it works now, I've made it only read them if they exist. --Nad 09:43, 16 March 2007 (UTC)
 * This works! Thank you for the quick response... --BB70 12:02, 18 March 2007 (UTC)

Parameter openlevel
When I use the paramater openlevel=1 (I also tried id=1) the tree stays closed. I tried the example in the article-text with the same result. Is there something else in the configuration I must change to get this work? --BB70 09:11, 19 March 2007 (UTC)
 * I've found the solution... It's not openlevel but openlevels --BB70 09:52, 19 March 2007 (UTC)
 * Sorry about that - typo fixed --Nad 21:00, 19 March 2007 (UTC)

JavaScript not being included
I have the same problem between 3.1 and 3.5. Here is my testwiki from home computer: testwiki two_php_files_modifiedphp_files
 * Well it seems to be wroking perfectly except for not adding the javascript for some reason - that bottom line problem is as I suspected which is that you have made an item two levels deeper than the one before which isn't allowed. I've updated it to add the JS in a better way which may solve your problem. If not there's a hack you can add to your localsettings after the treeview include to force it to add the javascript - the only drawback is that it'll be added even if there's no tree on the page.
 * $wgTreeView->addJS($wgOut);
 * Hmm, if i add the line above in my localsettings.php, i got the follow error message:
 * Fatal error: Call to a member function addJS on a non-object in /var/www/mwiki/LocalSettings.php on line 144
 * Besides, i just create a simple tree with only one sub-layer but result isn't much differentsingle-layer-tree
 * Lastly, i found that if i `touch` localsettings.php, then problem go away. But if i went to other computer and the Javascript just not insert again. This even happen between different browser (eg.IE and firefox). Could it be due to any setting on wiki i mis-configured? or sth i omit on LAMP configuration?
 * You must have added the hack before the include of the tree to get that error --Nad 08:13, 28 March 2007 (UTC)
 * I tried to add the line just right before "?>" and before "include_once('/var/www/mwiki/extensions/treeview3.php');". But it doesn't give me any different result apart from the line where error occurred.
 * Sorry, my mistake - you'll need to put the hack at the end of the wfSetupTreeView function before it's closing curly brace --Nad 23:35, 28 March 2007 (UTC)
 * and also change it to $wgTreeView->addJS($GLOBALS['wgOut']); since its inside a function now.
 * Also, are you using the usual MonoBook skin? your problem sounds a lot like bug 3603 which was that the monobook skin wasn't adding the headscripts, that was resolved in 1.6. --Nad 00:07, 29 March 2007 (UTC)

I also had the same problem. I'm on MW 1.9.3, Treeview 3.52 (2007-03-27) - standard monobook skin (some modifications to css, but none to the php file). Treeviews worked fine in preview mode, but no js was added to page in article mode. Tested a very simple treeview to eliminate weirdness there. Your hack above - $wgTreeView->addJS($GLOBALS['wgOut']); - works. Would link to the wiki, but it's on an intranet only. Zarius 10:53, 16 April 2007 (UTC)

Treeview in Sidebar!?
Hi as I can see on http://www.wikifs.org i.e. there must be a possibility to use the Treeview instead of the original Sidebar from MediaWiki. May anybody like to give a clou how it works?! Thanks.
 * I just commented out all the sidebar stuff in /wiki/skins/MonoBook.php and replaced it with the following, which then uses the "Navigation" article as sidebar content. You'll also need the CURRENTUSER variable for some of the links in you sidebar tree. --Nad 20:49, 3 April 2007 (UTC)

global $wgUser,$wgTitle,$wgParser; if (is_object($wgParser)) $psr =& $wgParser; else $psr = new Parser; $opt = ParserOptions::newFromUser($wgUser); $nav = new Article(Title::newFromText('Navigation')); $out = $psr->parse($nav->fetchContent(0,false,false),$wgTitle,$opt,true,true); echo $out->getText; return true; }


 * Isn't there an easier way, like by using MediaWiki:Sidebar? I tried doing it but I don't think that field recognizes templates (or however Treeview is called). There needs to be a user-friendlier way of adding/editing the sidebar treeview menu than having to dork with PHP files... :/ -Eep² 22:08, 23 July 2007 (UTC)
 * No, for some reason they didn't make MediaWiki:Sidebar allow wikitext and there's no hooks allowing it to be extended. We use Extension:WikiSkin which allows the entire skin to be defined in wikitext. --Nad 22:51, 23 July 2007 (UTC)
 * I added a new hook to Monobook.php (just one line of code) right at the top of the nav bar and tied the navtree to that hook. And I used mediawiki:Common.css to hide the original navbar items with #p-navigation { display:none }. This works fine, see http://semeb.com/dpldemo. Algorithmix 07:02, 16 August 2007 (UTC)

I've got the Problem that the tree does not open at anytime? sometimes it works and sometimes not, is there anybody with a helping hand or the same problem?
 * It sounds similar to the problem above under the "JavaScript not being included" heading. Otherwise, give me the url of your wiki and I can have a quick look --Nad 10:01, 11 April 2007 (UTC)
 * I can't come out I am sitting behind a firewall. :( What kind of problem might it be? Setting the var. $wgAllowUserJs = true; does not change a lot.:(
 * Have you tried the hack recommended above? is you tree in normal page or in sidebar? --Nad 21:07, 11 April 2007 (UTC)
 * Oh yeah my mistake. Think I have to learn reading again ;) Thank you for you fast answeres!! Now it works.

Subtree functionality
I'm having problems getting the subtree functionality working. I took your example and Tree1 does not show Tree2 as a folder that I can click to open. It just shows as a DOC icon. Here is my code:

Roger R Cruz 22:18, 14 May 2007 (UTC)

Treeview can't be invoked from a template
I have the following template: Test

when I try to invoke it in another page via

I get the following error: O@@@ Tree1 Item1 Item2 C@@@ Roger R Cruz 22:40, 14 May 2007 (UTC)
 * That's a current bug which I'll fix when I've got some time to work on it next, but there's a temporary solution, for example to transclude your "Test" tree article, do the following:

Empty Folder
I have the need to create just the top level bullet list (folder) that does not have any sub-entries below it. However, if I don't at least include a list subentry (** subitem 1), I don't get a folder to show for the tree. It shows as a DOC. --Roger R Cruz 22:52, 14 May 2007 (UTC)
 * All nodes having no child nodes show as a doc (leaf node), you'd have to change $wgTreeViewImages['doc'] to your folder icon if you want them all to be folders regardless of whether or not there's any child nodes. --Nad 23:31, 14 May 2007 (UTC)

Missing JavaScript and missing parser tags
I'm having problem similar to the other non-included JavaScript issue on my two wikis (running 1.10), but the head JS is included, and the Body JS isn't, so none of the folder icons are clickable (to expand the tree!) I would link to the wikis but they're on my computer and on an intranet... I will provide any troubleshooting information needed upon request.

Thanks! Rockerbaby 19:15, 7 June 2007 (UTC)
 * I have the current version running properly on 1.6.10, 1.9.3 and 1.10.0, so it's not a mediawiki version problem, if either of your wiki's are publically accessible I could have a look and see if I can see what the problem is... --Nad 22:53, 8 June 2007 (UTC)


 * I will set up a blank test wiki (running 1.6.9 due to the fact that my host only supports PHP4) and install the extension there. I cannot open the 1.10 wikis to the public due to ISP restrictions on servers, but if it helps I can copy the produced HTML code and the LocalSettings.php files to my userspace here. What happens is the A HREF tags in the body aren't being copied into the rendered content. I removed all other parser hook extensions to check for compatibility, and it still didn't work. Thank you for your help! Rockerbaby 04:52, 9 June 2007 (UTC)


 * Actually All fixed. Turns out I had the file extensions wrong on plus and minus in the configuration, so the links weren't even showing up. Oops! Rockerbaby 05:24, 9 June 2007 (UTC)

Tree View Doesn't Display at all
I have installed the extension and the pictures, added it all to the localsettings. When I try the syntax all I get is Root displaying. Only Root shows. Any ideas? Please e-mail me @ mike.madeja@gmail.com, Thanks
 * I have the exact same problem. Manu3d
 * This problem has been solved, it was due to wrong image paths. Check the html source of the page containing the problematic tree in your browser, and ensure that the image paths it's using are correct. --Nad 21:00, 27 June 2007 (UTC)

Tree View in Sidebar : advanced

 * I integrated Tree View in the side bar and its working so far (ehm so great)
 * I don't like to miss "Seek" and "Toolbox", anythig else is missing using personal css, (and will show up again for other users)
 * but I'ld like to see Tree View on top, just below the logo and before the seek-option

I can't figure out to change from "MonoBookTemplateToolboxEnd" to the beginning of this array (while the automatic changing of the Toolbox-content should be still working)

Any Idea? - Thank you!
 * If you're wanting more control over the sidebar content, then you'll need to hack the /skins/MonoBook.php file. The way I do it is to replace the part of the file which renders the toolbox with the following code which allows the MediaWiki:Sidebar article to contain normal wikitext such as a treeview:


 * I asked for "Any Idea", and you are right presenting this one. But I have to face that this informtaion is to heavy for me.
 * I did a workaround within monobook.php:


 * 1.) Killing line
 * which I found in the end of div
 * which I found in the end of div


 * 2.) including
 * which I placed just behind the closing div of
 * seems to work so far
 * seems to work so far
 * seems to work so far

Collapseable tables
Hello, I am seeing a error when I place a treeview inside a template page, and then refer to that template in a [collapsible] table. Once I click on show, it expands all of the nodes at once, but still shows the root nodes as unexpanded. Is there any way to make the treeview resume the default setup and not expand every node? --Jgetzke 15:50, 17 August 2007 (UTC)
 * Can you give me a link to the site this is happening on or is it intranet? --Nad 22:37, 19 August 2007 (UTC)
 * Unfortunetly it is on intranet. If you want, I would be happy to duplicate the error on your wiki.  You would need to install the Navframe/collapseable function from Wikipedia first.  Below is what the code looks like on our wiki:  --Jgetzke 16:12, 20 August 2007 (UTC)


 * style="border: 3px solid #E41F1F; align: left; color: #42617B; height:210px; font-size:11px; width:300px;" valign="top" |


 * Sorry for the slow response, I've been away and have a lot of work to catch up on. If you like you can set up the problem on www.wikifs.org, which is one of our test wiki's, I can make you a sysop on it so you can access the css and js articles. --Nad 23:22, 24 August 2007 (UTC)

Sidebar Tree Issues
I'd like to be able to replace the navigation box at the top of my sidebar with http://daniel.cook.name/index.php?title=FamilyTree but the I'm not sure what to replace in monobook.php. I read your comments above (from April 3rd)"I just commented out all the sidebar stuff in /wiki/skins/MonoBook.php and replaced it with the following" I cannot figure out what stuff to comment out...  Can you please be a little more descriptive?

...Also, how do you get your sidebar to dynamically resize at http://www.organicdesign.co.nz/? Thanks in advance.
 * Not sure what you mean by this, my sidebar always stays the same size...? --Nad 23:52, 24 August 2007 (UTC)
 * Click on Site Map - The Nodal Model. Watch your sidebar grow to the right to accommodate the text.
 * I see, it probably happens by itself because we use a table for our layout (using Extension:WikiSkin to define the skin in an article instead of a file). It can probably be done with css too, but the guy who does most of our css (OrganicDesign:User:Rob) is on holiday for a couple of weeks and I'm not all that good at it. --Nad 02:31, 25 August 2007 (UTC)

Okay, thanks. I'll take a look at WikiSkin. Regarding the first question. Can you please tell me what I should delete and exactly where I should drop this code in to Monobook.php?

global $wgUser,$wgTitle,$wgParser; if (is_object($wgParser)) $psr =& $wgParser; else $psr = new Parser; $opt = ParserOptions::newFromUser($wgUser); $nav = new Article(Title::newFromText('Navigation')); $out = $psr->parse($nav->fetchContent(0,false,false),$wgTitle,$opt,true,true); echo $out->getText; return true; }

I've created a copy of my FamilyTree article and called it Navigation. I'd like to lose the default navigation and toolbox and replace them with mine. I appreciate the help!
 * I've added a modified version of Monobook.php at Replacing sidebar content which has the search, toolbox and language links commented out, and the code added to render the navigation article in their place. --Nad 04:03, 25 August 2007 (UTC)
 * You ROCK, Nad. Thank you.  [EDIT] Hmmm.  I get

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/listcoo6/public_html/daniel/skins/MonoBook.php on line 266 Ideas?
 * Oops didn't have the php delimiters quite right - probably best just to remove those commented out bits you don't want anyway (make a backup of the file first tho). And may be best not to use the version on OD just in case the version isn't the same as yours - that example was from a MW 1.10.0. --Nad 04:23, 25 August 2007 (UTC)
 * You may want to also install Extension:Semantic MediaWiki at some stage too which allows relationships between the people to be defined for better reporting etc. I'm working on a gedcom importer for mediawiki too, but have had too much work on recently to make much headway with it but the format doesn't look too difficult. --Nad 04:38, 25 August 2007 (UTC)

Excellent lead on Extension:Semantic MediaWiki. Thanks for everything.