Extension talk:TreeAndMenu

error 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)

Display only text of first item?
i have done the following:

1) copy and paste treeview3.php into extensions folder

2) include_once('extensions/treeview3.php'); $wgTreeViewImages = array( 'plus' => '/intranet2/mwiki/images/7/72/Arrow-closed.png', 'minus' => '/intranet2/mwiki/images/a/a0/Arrow-open.png', 'opened' => '/intrane2/mwiki/images/4/46/Folder_opn_sml_blu.gif', 'closed' => '/intranet2/mwiki/images/6/6e/Folder_sml_blu.gif', 'doc' => '/intranet2/mwiki/images/e/e3/Doc-icon.gif', 'spacer' => '/intranet2/mwiki/images/c/c0/spacer.png' ); 3) edit a page with following:

but so far all i get is Root displayed as text. i have done chmod 777 for the images above. There is not even an error message shown. Can someone help me? i am using latest mediawiki with php5, Mysql5 and apache2.
 * If the images aren't showing then the path is probably wrong or the images don't exist, because the wiki must be able to access them since its the one that should have saved them there - have you uploaded them into your wiki and checked that their exact paths in browser properties of the images? --Nad 09:35, 23 March 2007 (UTC)
 * When i put all images file into one single folders, they work.. very strange. But then the tree only work on preview screen. if i click saved, the tree are all expanded and the 'arrow' image clicking give me no response. Is there sth wrong with my wiki installation? i was testing out the "pdf extension" which was experimental exhibit the similar behavior. It seems to me sth is wrong with my wiki setting. it is my first time setting up wiki ....any help appreciated.
 * What's the url of your wiki, I'll have a quick look --Nad 00:58, 26 March 2007 (UTC)
 * i afraid i can't as it is in LAN. Is there any particular file you want to look up ? i can post it here.
 * What it says in special:version is always useful, and the LocalSettings.php file since no other files should have been changed in anyway other than that (apart from the added items in extensions). Also it sounds from what you've said that you're putting the images directly into the file structure - I find it best to use the wiki's "upload file" process instead so you can be sure that they're in the exact state that the wiki needs them in. You can then get the actual file path the wiki's put them at by getting the image's properties in your browser. --Nad 03:14, 26 March 2007 (UTC)


 * Also if you go to a page with a tree, do an edit preview and save the html source of the page that would be useful too because from that I can see both the tree's wikitext and the rendered html result. --Nad 03:28, 26 March 2007 (UTC)
 * I have put the 4 file into text, as they are probably too long to post it out.
 * Besides, my first post make a mistake about the root directory. the wiki root dir is /intranet2/ which is not the same as apache root dir. I imagine it probably be the source of problem. I realize that javascript isn't generated in resultant page.
 * I see you guys are using the dotdeb hardened php5 on Debian - we use that too ;-) For some reason the javascript function which is only being added in the page preview not the normal view, other than that the generated treeview html all looks correct. You could try downloading the latest treeview version 3.5 which does its javascript include in the parser-function instead of the taghook so that may help. If the images are still not showing, just try the way I described above of using the normal mediawiki "upload file", I think that's most likely to fix them --Nad 05:16, 26 March 2007 (UTC)
 * I think I make a mistake of not use $IP to prefix the treeview3.php directory location. Now the expand and collapse work, but with little issue. The last folder once i collapse, i can never open it. But it doesn't happen in preview?
 * That last little glitch is probably your tree wikitext, the html source shows that the last item is two levels deeper than the preceding item which will cause undefined results. --Nad 05:33, 26 March 2007 (UTC)
 * After i do upload via wiki and change to viewtree3.5 i still can't get good result :( It will work until i press ctrl+F5 to refresh the page. From that onward the expansion & collapse of tree stop working. In IE i got 'object expected' Error.
 * I can't do much without being able to see it - I could have a look at the html source again since you've changed version. Do you get that refresh problem on treeview3 as well or only 3.5? --Nad 02:40, 27 March 2007 (UTC)
 * 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?