Extension talk:TreeAndMenu

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; }

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)