Extension talk:TreeAndMenu

Use cookies?

 * Has anybody added cookie functionality to this extension yet? It would be great if opened/closed trees remained that way from page to page. SeanFromIT 18:36, 2 October 2007 (UTC)
 * I'm back on tree now and working on custom images and persistence --Nad 00:58, 3 October 2007 (UTC)
 * Persistence is now available via cookies in version 5.x.x --Zven 23:01, 10 March 2008 (UTC)

How to open only certain folder by default?
Hi, is there any way to open only certain folders by default instead of all or nothing? Thanks (again) in advance. --71.184.105.187 03:18, 4 September 2007 (UTC)
 * Currently the only way to do that is to use multiple trees each with their own openlevels parameters. --Nad 03:25, 4 September 2007 (UTC)
 * Perfect. Thanks! --71.184.105.187 03:31, 4 September 2007 (UTC)

Can't hide toolbox and navigation
Hi, I followed the directions on adding CSS to hide the toolbox and navigation sections, but it hides the tree, too. This is at http://wiki.passwordmaker.org. If you view the HTML source of that page, you'll see MediaWiki renders &lt;div id="p-tb"&gt; around the NavTree, so hiding that div also hides the tree. How do I make the tree render outside that div, or is there another solution? Thanks in advance. --71.184.105.187 00:21, 4 September 2007 (UTC)
 * I had a look at the source of your page and it should be possible to hide the heading and bullets specifically while keeping the main portlet container visible. I've changed the notes at Extension:Tree_view to reflect this. Let me know if it works since our wiki's don't do the sidebar this way so I can't test it myself. --Nad 00:38, 4 September 2007 (UTC)
 * Very close. The only thing remaining is &lt;h5&gt;Toolbox&lt;/h5&gt;, which is between the p-tb div and the pBody div. Take a look at the source again to see what I mean. It's too bad IE6 doesn't understand descendant selectors otherwise we could write #p-tb > h5 {display: none;}. Any other ideas? --71.184.105.187 02:32, 4 September 2007 (UTC)
 * No it's my fault, there shouldn't be a dot before the h5 selector as that specifies an element with class="h5", it should be fixed with the dot removed --Nad 02:47, 4 September 2007 (UTC)
 * That's it! Thanks for such a great extension! --71.184.105.187 03:11, 4 September 2007 (UTC)

Constructing Toolbox Links
Ok, last problem (I think)... When I try to duplicate some of the links in the normal toolbox - specifically the 'What links here', 'Related changes' & 'Printable version' links - using the {PAGENAME} variable, they don't work right for pages that have spaces in their names... see http://wiki.passwordmaker.org/index.php/How_it_works - even though apparently Mediawiki automatically adds the underscores to the page name, the actual page name has spaces, not underscores, and apparently the {PAGENAME} variable doesn't capture them correctly - I'm guessing this is a MEdiawiki bug, not necessarily a Treeview bug, but any ideas on how to fix this (worst case, I can rename all of our pages to ones with explicit underscores, which may not be a bad idea anyway)...
 * You should use the FULLPAGENAMEE variable (notice double E on the end meaning "encoded"), the best wikitext to make the link would be:

[ What links here]
 * --Nad 13:02, 4 September 2007 (UTC)
 * Hmmm... the above didn't work, but this did:

[fullurl/Special:Whatlinkshere/ What links here]
 * I was careful to recreate yours precisely, so don't know why it didn't work... but as I said, the above works, so unless there is a good reason not to use it, I think we're good to go... thanks for the pointer to the FULLPAGENAME variable!
 * "fullurl" is a mediawiki parser function, the wikitext above should have been copied and pasted exactly as is including the word "fullurl". It's ok how you have it now, but using fullurl is better as it's independent of your wiki's installation location etc. --Nad 22:35, 4 September 2007 (UTC)
 * duh! Thanks for banging me on the head! Much better, thanks!
 * hmmm... now, what is the 'Special' target page for the 'Printable version'? Tried 'Special:Printable' and 'Special:Printable=yes'... thanks again for your help! - charles, 5 Sep 07

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)

I am having the same problem... here is our wiki so you can see what it looks like - see the 'toolbox' and 'navigation' entries underneath the real 'toolbox'? I'm completely open to the possibility that I did something wrong, but I dbl-checked and can't find a syntax error or anything in the mods I made... any help appreciated!

Yes, we are also having the same problem with the code from 30-Aug-07. MediaWiki 1.10.0 and the extension DOES show up in the special:version page!


 * I can see what the problem for the site at the url shown above from html source of the page. The treeview image paths are not set to the url's of the uploaded images, it's best to use $wgUploadPath to set the image names (I've updated the documentation to use it). Also the required image "doc-icon" is missing, probably because it was missing from OrganicDesign:Category:Tree view images but has been added now. --Nad 21:50, 31 August 2007 (UTC)


 * A few people have had trouble in the past with setting up the images properly, so I've made a new version (3.6.1) which requires only the image titles with no preceding path information, and only those that are different than the defaults need to be defined. The documentation has been updated again to reflect these changes. --Nad 23:33, 31 August 2007 (UTC)


 * That did it, thanks! Looks like your renamed Spacer.gif to Blank.gif too? This confused me for a bit (no indents in the tree). --71.233.89.119 02:19, 1 September 2007 (UTC)


 * Yeah some people had trouble with spacer.png because IE doesn't render png transparency properly without the monobook JS hack, but blank.gif works fine. --Nad 02:50, 1 September 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)

I have copied the file Treeview4.php to the extension folder, inserted the lines

include("$IP/extensions/Treeview4.php"); $wgTreeViewImages['plus']  = "Plus.gif"; $wgTreeViewImages['minus'] = "Minus.gif"; $wgTreeViewImages['opened'] = "Folder_opn_sml_yel.gif"; $wgTreeViewImages['closed'] = "Folder_sml_yel.gif"; $wgTreeViewImages['doc']   = "Doc-icon.gif"; $wgTreeViewImages['spacer'] = "Blank.gif";

to the LocalSettings.php, but the extension is just not working (http://wiki.gorebiobio.cl/index.php/Test) and not even showing up at the version page (http://wiki.gorebiobio.cl/index.php/Especial:Version). What´s wrong?? Thanks in advance for your help! --Horst Salzwedel 00:34, 8 February 2008 (UTC)
 * That's very odd - the script is there, but it must not be getting included for some reason... apart from that problem though - you'll need to either upload the images via the normal mediawiki upload, or change your $wgTreeViewImages values to full pathnames. --Nad 07:24, 8 February 2008 (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.

Nodes instantly collapse after expansion
Hello! - I'm having two problems that I can't figure out...
 * When I expand a node, as soon as I click on an item in the list, the node collapses again - very frustrating - and,
 * That's a strange problem?! can you give me a link to the wiki in question? if not supply html-source code of page having the trouble, and let me know info from special:version page. --Nad 06:48, 1 September 2007 (UTC)
 * http://wiki.passwordmaker.org... I'm working with Eric on getting Treeview working properly, and he already got your help with hiding the normal toolbox and navigation trees (thanks!) - The bottom unexpanded 'toolbox' and 'special' trees exhibit the problem...
 * No idea on how/why to get these to stay expanded after a link is clicked? -- Charles, 05 Sep 07
 * Are you meaning that when you click on a node, it goes to that page correctly, but then after the new page loads the tree is no longer open to the correct position? or do you mean that when you click a node the tree closes up straight away without even going to the new page? if the former, then unfortunately the current version cannot remember it's open position, but this feature is in the development pipeline. --Nad 11:26, 5 September 2007 (UTC)
 * Ahhh... ok, yes, I meant the former - it does open the link, but then the tree collapses again... good to know this is being worked on... thanks again for all your help!


 * Is there a way to make some of the nodes expanded by default?
 * Add openlevels=some-number to your tree definition. I've added an example in the usage section. --Nad 06:48, 1 September 2007 (UTC)

Thanks for any help! - charles

Differences between treeview4 and former version, wishes
Hello Nad,

the new version produces a tree which is always indented by '16 spacers'. This consumes space. The older version did not do that (which I think was better). You might want to change line 118 to . "$open"

Apart from that it would be nice if one could use explicit line breaks in the tree element texts. Sometimes a label is too long and should be broken at a certain point. Putting a line break marker like \n into the text (which you could find and then break the label accordingly) would help. Using  directly leads to the next line starting at the very left which looks awkward.

Third, it would be good if the "width" parameter could be changed by the user (I would prefer 12 instead of 16 which gives less indentation per level). If you try bigger values like width=32 you will see that something is not correct with the vertical alignment.

Thanks, Gero from DPL (Algorithmix 09:43, 8 September 2007 (UTC))
 * Ok I'll add the newline soon, and make the width definable by the user. I indented it differently starting at version 3.6.2 because even though it seems too indented now, it was actually logically incorrect before because the doc-nodes and folder-nodes of the same level should be exactly lined up. --Nad 11:13, 8 September 2007 (UTC)
 * I just updated to to 4.0.3 which has the whole-tree-being-indented problem fixed and adds $wgTreeViewIndent which is set to the number of extra pixels to indent each level by. If it's set to zero (default) then it will use the pixel width of the doc icon. Haven't added newline capability yet. --Nad 12:04, 8 September 2007 (UTC)

Custom Images
Nad - I would like to ask for you to consider adding lines between the nodes in Tree View with a future revision. You can see what I mean here with [DTree]. Well, I finally figured out how to get my [Family Tree] in the sidebar, so I put Wiklets on the shelf for another application someday. Thanks for your cool extensions.

[EDIT] One more thing if you will. It would be nice to have the ability to change the icon for the root. In my case I would use something like this  Still haven't figured out what would be good for open and closed. Definitely not folders, but I'm still looking. --Cooknn 19:57, 9 September 2007 (UTC)
 * Those would be good features, I'll see if I can get them done soon ;-) --Nad 02:35, 10 September 2007 (UTC)
 * At the risk of wearing out my welcome, could you look at the possibility of using custom icons for *any* node? For me that would be cool as I could use the tree for root then a male or female icon for the descendants of my family tree.  I think DTree allows for that as well.  Maybe there are some clues in his .js :) --Cooknn 22:39, 10 September 2007 (UTC)
 * Don't worry, I was thinking along similar lines. I just have to think of the best way to handle it... I'm thinking of moving all the image specification into css and making the code just generate css-classes. I could then make a way to override the class by supplying a parameter in the tree's row. I've redone the main rendering code in preparation for adding the dotted lines between nodes, so that should be ready soon too --Nad 02:15, 11 September 2007 (UTC)
 * Nice! One good thing I noticed about about DTree is how the nodes line up vertically.  The + and - signs are centered directly below the parent node, therefor the children's icons and text descriptions all line up vertically even if they have children as well.  I guess it would be hard to incorporate the lines between nodes if that wasn't the case... Good luck, and thanks for your work! --Cooknn 12:27, 11 September 2007 (UTC)
 * Have a look at OrganicDesign's sidebar tree now, that's using TreeView4.0.5 which has connector lines, but with a couple of small bugs to iron out. I should have 4.0.6 finished tomorrow which will have the line bugs fixed, and will allow specifying icons on a per node basis using   where each parameter is an image name and the "opened" parameter is optional. --Nad 12:47, 11 September 2007 (UTC)
 * Yeah!!! Looks great :) --Cooknn 14:29, 11 September 2007 (UTC)
 * Hey thanks a lot for the donation! ;-) --Nad 22:22, 11 September 2007 (UTC)
 * No problem. Thank you.  Your next Beer Thirty can be on me :) --Cooknn 22:46, 11 September 2007 (UTC)
 * Phew - those connector line things were pretty tricky! but they're working properly now ;-) probably best to wait for 4.0.7 though because I still have some finishing touches (such as making $wgTreeViewShowLines enable/disable them) and to implement $wgTreeViewIconMagic for allowing rows to change their icons. Also I need to be able to have an optional root node at level 0 which has no +/-. Once I've done those things I'll make version 4 the main stable version because I think it's rendering method is more solid and efficient than 3.6.x. --Nad 09:23, 12 September 2007 (UTC)
 * I could see that the lines were becoming a challenge. Appreciate your diligence.  When trying the 4.0.6 at my site everything looks the same as on your sandbox except I'm losing my css font style for some reason.  Are mod's to that file necessary?  Here's my MediaWiki.css currently.  The addition of $wgTreeViewIconMagic will be sweet :) --Cooknn 11:13, 12 September 2007 (UTC)

There is a slight change to the css structure (dropping the tr.tree-row class and adding td.tree-text and td.tree-icon, my css is as follows: --Nad 12:23, 12 September 2007 (UTC)
 * I updated the CSS slightly again after fixing a bug preventing multi-line items from working properly. --Nad 00:53, 13 September 2007 (UTC)
 * I've got the latest CSS (slightly modified) up at daniel.cook.name. Looking good. I found some icons to work with my family tree.  Here they are [[image: Dcmale.png]] [[Image: Dcfemale.png]] [[image:Dcouple.png]] .  I'll use the male and female icons for descendants regardless of whether there are children or not.  If there are, when opened I'll display the couple.  That should work, right?  Heh.  Sorry man.  I hope I'm not being difficult :P --Cooknn 01:24, 13 September 2007 (UTC)
 * No worries, tree-view's come a long way thanks to your feedback ;-) --Nad 02:33, 13 September 2007 (UTC)
 * Been extremely busy lately. Just checking in with regards to custom icons.  4.0.8 maybe? --Cooknn 23:11, 26 September 2007 (UTC)
 * Sorry I've also had rather a lot on my plate over the last few weeks, but it's in the pipeline and I'll try and get back on to some tree soon --Nad 02:08, 27 September 2007 (UTC)
 * No need to apologize! I was just making sure it was still in the pipeline.  Thanks again for a great extension. --Cooknn 12:34, 27 September 2007 (UTC)
 * Well better late than never I guess! I finally got those custom icons in there, still more to do on icons though because I want the tree to be able to work with SVG's so it needs a better way of handling image sizes. --Nad 07:22, 10 October 2007 (UTC)
 * SWEET! Your work is appreciated :)

Do I need to edit my CSS in order for the custom images to replace the default folders? Also, can I still have lines, or is that still a work in progress? ...Initially I thought I'd use the male or female icon for closed folders then for open folders use the couple icon. And of course for the root I was hoping to use the tree for both open and closed. Possible?

That result means the images are being treated as normal row content which means that either it hasn't been updated or the image wasn't the first thing on the row (or something in the new code isn't working)... --Nad 21:02, 10 October 2007 (UTC)
 * [EDIT #2] Okay, I'm talking to myself too much here. Feeling a bit schizophrenic :P  I need to disable the folders and icons, don't I?  I guess if I do that I won't be able to get the male or female expanding to the couple, but that might have been a little ambitious for a tree extension anyways...
 * You shouldn't need to change any of the nromal folders - if a specific image is supplied it (is supposed to) overrides the defaults. --Nad 21:02, 10 October 2007 (UTC)
 * It looks like you've downloaded the old version (as in 3.6.2 not 4.0.8), check your special:version page. I noticed that the download link hadn't been updated and then I checked the logs and saw that among the last items you'd accessed were Treeview.php not Treeview4.php (I've updated the download link and slapped a legacy template on the old code) --Nad 21:26, 10 October 2007 (UTC)
 * That was it. I downloaded the wrong version somehow.  Good catch!  Hey, will this still work?  Where would I place that code?  I'm thinking I can do my male/female changing into the couple upon expansion with that code if I knew where to put it :P --Cooknn 02:32, 11 October 2007 (UTC)
 * No I changed my mind on #icon and just added a single image. I will handle both opened and closed at some stage though, but will probably just make it that you supply two normal image links instead of one rather than using #icon. The main reason for changing my mind on #icon was that I want to be able to use the mediawiki code for handling different pixel sizes for SVG's etc --Nad 02:49, 11 October 2007 (UTC)
 * Okay, cool. Just keep me posted :)  For a look at your current build in action head over to daniel.cook.name - I like!
 * Nice ;-) that looks much more down to earth. That tree is quite large, you might find response times improved if you use Extension:Livelets and put the tree in a . That allows the tree to load after the page itself so the page becomes responsive straight away, and also the browser can cache the tree separately regardless of what page you're viewing. --Nad 03:23, 11 October 2007 (UTC)
 * I'll definitely look into Livelets. Thanks for the tip.  --Cooknn 04:28, 11 October 2007 (UTC)

Breaks Live Preview
Hi, Nad. I know I can't rightfully expect that you would support an experimental MediaWiki feature, but here goes at least making you aware. I have MW 1.11.0 on my computer, and am preparing it to be launched as a wiki for a project I'm doing with some friends. I just discovered the Live Preview function and tested it, and it works quite well, except (it seems) when the page being previewed contains a tree with more than one root in it, at which point the returned text is cut off. Looking at what I'm actually getting "back" from my computer as a result of the POST, I notice that it appears to include all the text, but the script isn't displaying it all. I'm no AJAX whiz, so I was wondering if you could track this down?
 * Thanks for the great extension; aside from this, it works great! — Tuvok[Talk/Contribs] 04:47, 17 September 2007 (UTC)
 * Interesting problem, I'll check out the live-preview with tree on my new 1.11 install soon --Nad 07:36, 17 September 2007 (UTC)
 * Yay, I had a problem that was interesting... :D Just being silly; thanks for the quick response! Looking forward to seeing input from a developer on this. — Tuvok[Talk/Contribs] 09:06, 17 September 2007 (UTC)
 * Unfortunately I haven't been able to get the live-preview to work in either 1.10 or 1.11 and there's no docs on it - did you do anything other than set $wgLivePreview to true in LocalSettings? --Nad 03:54, 20 September 2007 (UTC)
 * Let's see... I could post my configuration file. I'll create a sanitized version and post it to a website I have with Google. You'll find it at http://voyagerfan5761.googlepages.com/LPSettings.php
 * I don't think I changed anything but the one variable, but my setup was heavily customized as it was, so something else might need to be changed. If you've disabled $wgUseAjax, that'll definitely block LP. — Tuvok[Talk/Contribs] 00:16, 21 September 2007 (UTC)
 * Oops, I didn't realise you had to turn it on in your preferences :-/ I'll be able to check out the tree problem soon --Nad 00:48, 21 September 2007 (UTC)
 * I just did a test of live-previewing a page with a tree in it and it works except a minor bug which hides some of the bottom of the tree behind the preview... in what way is your live-preview breaking, is your tree the latest version? and can this bug be viewed or is it intranet? --Nad 00:54, 21 September 2007 (UTC)

(clear indent) I have version 4.0.6. What I'm seeing is when a tree with multiple root nodes is previewed, the second root is the last element displayed (sometimes with its text truncated) and all the preview text after it is also chopped. I can post a screenshot, too, if you like. Should I take down the config file?

Unfortunately, the wiki is indeed an intranet. Technically, that is. Only I use it, on one computer. But it will be put up on the Internet some time, with restricted access, because it's for a project I'm doing.

It seems that this could perhaps be an issue with the LivePreview JavaScript and yours conflicting, given that things are truncated. Maybe, if you have Firebug in Firefox, you can look at the changes to the DOM in real-time when you preview a page and see if it's conflicting with something. Thanks for the attention! — Tuvok[Talk/Contribs] 10:25, 21 September 2007 (UTC)
 * yes I'm getting that same thing, at first I thought it was just being half hidden behind the textarea, but then when I checked in firebug I found that only part of the html was being received by the ajax request. I then checked the live preview on some other content which was not treeview related and found that also was being chopped. I believe that the live-preview code is deliberately imposing a maximum on the amount of content it retrieves. I'll check the live-preview code soon and confirm. --Nad 11:41, 21 September 2007 (UTC)
 * I see I neglected to mention that I preview after the edit box... whatever, it doesn't matter (or shouldn't). I think it can be narrowed down to a conflict or bug in preview.js or EditPage.php. You agree? — Tuvok[Talk/Contribs] 15:07, 21 September 2007 (UTC)
 * I'm not sure but it seems to be done on purpose I think. I can't find anything in the live-preview code which is doing it, but I still have to check the ajax code. If it's done on purpose then there should be a setting which can be adjusted to allow a larger maximum. --Nad 20:19, 21 September 2007 (UTC)
 * Truncating previews on purpose wouldn't make much sense, since the Live Preview is intended to completely replace the standard preview and eliminate the need to load multiple pages when editing. I don't think I've seen any truncation issues with non-Tree view content. — Tuvok[Talk/Contribs] 01:50, 22 September 2007 (UTC)
 * Well it might be an idea to test that for certain. I've found it chopping, I'm finding it's chopping everything, even plain text at some uncertain size between about 1KB and 3KB. --Nad 09:51, 22 September 2007 (UTC)
 * It also chops pasted wikimarkup from Linda Chung, and when I asked for 50 paragraphs from my local "Lorem ipsum" template (actually a copy of Wikipedia's) it returns less than ten of them. It probably is a preview thing, though I can't imagine what. It's not your extension, then. Thanks for testing it, though, all the same. I'll report a bug to Bugzilla. — Tuvok[Talk/Contribs] 13:28, 24 September 2007 (UTC)
 * Niklas Laxström committed a new version of Live Preview to the next release that works around the text-chopping problem in SVN r26073. Which means that either 1.11.1 or 1.12.0 will have the fix. It may not return edit summaries, categories, or interlanguage links, but the live preview is starting to shape up. — Tuvok[Talk/Contribs] 14:03, 24 September 2007 (UTC)

Expand All Button
Hello All,

We are using this extension at work and I created an expand all button for it. Hopefully this code can be taken and added permanently to this extension. This way when the upgrade comes out I don't have to re write it ;)

This is written for Treeview 4.0.7

This is what you have to do:

Modify the treeview function by adding one line to the else # Determine the open/close link and the folder/doc icon if ($depth >= $default) { $open = $plus; $icon = $closed; } else { $open = $minus; $icon = $opened; $ibg = " style='background: url($vert) 0 10px no-repeat'"; } if ($depth >= $next) { $open = ""; $icon = $doc; $ibg = ''; } else { $open = "<img id='tvi$id$row' src='$open'/></a>"; $treeNodes .= "$row,"; }

add this to the end before the return

#add the array of tree nodes for the expand all function $this->addJSTreeNodes($id,$treeNodes);

return "<a href='javascript:toggleAllTreeviewItems(\"$id\");'>Expand All</a> "; }

Modify the addJS function by adding a java function }

function toggleAllTreeviewItems(id){ for (x in treeViewItems){ if (treeViewItems[x][0] == id){ for (y in treeViewItems[x]){ if (y > 0){ if (document.getElementById("tvr"+id+(treeViewItems[x][y]+1)).style.display == "none") toggleTreeviewItem(id,treeViewItems[x][y]) }}}}}
 * Thanks, I'll add the expand-all functionality into the next version, but I think it can be simplified a bit. Also, I can't see a definition for the addJSTreeNodes method shown above...? --Nad 21:46, 27 September 2007 (UTC)


 * Sorry about that, here is the addJSTreeNodes function, and yes, please do simplify it as much as possible :)

# Add a JavaScript array of tree nodes for the expand all function function addJSTreeNodes($treeid,$treeNodes) { global $wgOut; $wgOut->addScript('<script type="'.$wgJsMimeType.'">treeViewItems.push(['.$treeNodes.'"'.$treeid.'"]);treeViewItems[treeViewItems.length-1].reverse; '); }

}
 * I'm going to dump most of the current code and make Treeview5 a front-end for DTree which has all the cool features. --Nad 23:29, 14 November 2007 (UTC)

Folder images don't open or close on clicking
Hi, a curious problem... Having got the tree view extension working nicely both as an article and as part of the sidebar, whenever I click on the plus_sign or minus_sign the tree correctly expands or collapses, however the images don't change. Both gif images are showing so the application can find them but they don't alternate. I am using IE7 on Windows Vista. Any suggestions would be much appreciated as I haven't been this excited about web development for some time !

Thanks! Taz

Update: Got it working but I'm not sure why. This is what I did...

In localsettings.php the $wgTreeViewImages array was coded as follows:

$wgTreeViewImages['plus']  = "$IP/extensions/treeview4/Plus.gif"; etc.

I had to establish the path as setting it up as suggested, without any path name, didn't work. However, in the above format the treeview showed the images correctly when loading, but didn't change (to open/close) on clicking.

I then changed the above lines of code to read:

$wgTreeViewImages['plus']  = "/mediawiki/extensions/treeview4/Plus.gif";

This time it worked correctly.

The two questions are (a) why didn't it work in the suggested original format, without any path, i.e: $wgTreeViewImages['plus']  = "Plus.gif"; and (b) why didn't it work as $wgTreeViewImages['plus']  = "$IP/extensions/treeview4/Plus.gif";

Any insights would be much appreciated. The way it's designed to be set up most simply is for the images to be uploaded into your wiki via the usual "upload file" link, you can then specify the just the names of those images without any path. --Nad 05:13, 29 September 2007 (UTC)

I've also experienced same problem. Because I work in IT sector analyzed it a bit. Problem was in comparing current node image (from src attribute of image) to image src (from $wgTreeViewImages array). IE added server name to src attribute so it doesn't match url without server name from closed/opened variable. I propose such fix (around 210 line in ):

--Aik099 12:33, 18 November 2007 (UTC)

toolbox problem - won't display as collapsed with plus sign
Hi... love treeview, thanks!

We have a weird problem... our old wiki works just fine, and can be seen here:

http://wiki.passwordmaker.org/Introduction

We are moving it to a new server, and everything is fine, with this one exception... the replacement toolbox won't display collapsed with the plus sign. I have to add a 'openlevels=1' option to it, and then it displays all of the list items fine and the links all work... here is the link to the new one:

http://test.passwordmaker.org/Introduction

The NavTree code is identical... with the exception of the openlevels option we had to add to be able to get to the toolbox pages...

Any ideas?


 * Edit: never mind... somehow the Plus.gif went missing...

Collapse bug
Given the following:

If I expand both A and 1 and then I collapse A, 2 doesn't show up when I re-expand A. --Dataweaver 00:09, 10 October 2007 (UTC)
 * That's not really a bug, it's just that it doesn't do any form of persistence currently. I'm currently working on a new version which handles persistence and should resolve this issue though, but I've got a lot on and it may be a while away yet. --Nad 00:26, 10 October 2007 (UTC)
 * Umm... the fact that '1' is expanded can cause '2' to vanish isn't a bug??? This isn't about 1 remaining expanded or collapsed when you expand or collapse A; it's about 1's sibling no longer showing up after collapsing and re-expanding A, with the only way to get the subling back being to collapse 1 and then collapse and re-expand A again.  --Dataweaver 09:53, 10 October 2007 (UTC)
 * I see what he's saying, Nad. Same thing is happening to me.  Not sure if it just started with 4.0.8 or if this issue existed all along.  If I collapse everything down to the root, then re-expand, it only shows the first node.  Then if I collapse again, it shows one more node.  And so on until they all show up. --Cooknn 02:47, 11 October 2007 (UTC)  [EDIT] Odd.  I just finished a major edit to the tree and now it isn't happening...
 * Cooknn is right. I have managed to easily reproduce this bug with the last two versions of the extension. Take a look here for example... Note that root node ('Manda') has two subnodes ('Sava' and 'Novica'). Click on the root node and the whole tree collapses as expected. Then click on the root node - only the first subnode is shown. If you repeat this simple procedure once more, the second node will be displayed correctly. The collapsed tree does not expand correctly on the very first try, but expands correctly on all subsequent retries. Just strange... --Saxon64 08:44, 14 December 2007 (UTC)

Ordered Lists and Table of Contents
I'd like to set up my wiki such that each page's table of contents shows up as an expandable/collapsible tree. How would I do this? --Dataweaver 00:14, 10 October 2007 (UTC)
 * Interesting idea - I had a bit of a look at the parser code and I think the best way to go about it would be to turn the normal TOC off and add a new hook into ParserBeforeTidy which creates its own TOC by passing a copy of the page text to Parser::formatHeadings and then extracting the TOC from the returned result and converting it to a bullet list surrounded by a #tree, parse it and prepend the page text with the result. --Nad 01:09, 10 October 2007 (UTC)

Root node problem
Is there a way to lose the "up dot" on the +/- for the root node? I haven't dug in to 4.0.8 yet. Just curious. --Cooknn 15:39, 10 October 2007 (UTC)
 * That's a bug which has been on the todo list for quite a while :-/ --Nad 21:02, 10 October 2007 (UTC)
 * Please consider dropping the +/- completely from the root node. Or making it optional if you will.  I just checked DTree from DestroyDrop again and that's the way they do it.  Do you think it would work for your tree as well?  --Cooknn 00:11, 15 October 2007 (UTC)
 * I will fix this soon - it's not that the plus and minus should be removed from the root node - the problem is that there is no root node currently, but there should be able to be one. I'm just in the middle of some other work at the moment but will fix this soon. It should be that the tree can have content before the first * which would be the root node content. --Nad 01:36, 15 October 2007 (UTC)
 * Is this still on your agenda? As you know I did come up with a workaround, although it's not as elegant as it could be.  Basically had to sacrifice the size of the font for my sidebar (it's a little too small) in order to get the root node in line with the rest of the tree.  I'm not a CSS whiz or I probably could've figured it out :P --Cooknn 02:58, 16 November 2007 (UTC)
 * I've just been too busy to make any progress with my extensions for a while, but I've made a start on treeview5 which is just going to use DTree instead --Nad 19:20, 17 November 2007 (UTC)
 * No rush here, but the DTree integration sounds interesting. As a matter of fact, just today I put it to use for my son who is looking at all the majors at the University of Florida where he hopes to go to school.  I arranged the tree with the University as the root, then each school and then the majors with classes.  Worked pretty well and only took me about an hour to do. --Cooknn 03:26, 18 November 2007 (UTC)

Folder images not showing properly
For some reason the folder images are not showing properly in the IE 7 (though they appear fine in Firefox and are rendered ok most of the time in Opera). Any idea what might be causing this problem?

Here's how it looks: Apap
 * Is it a public site? I could have a look and see if I can see anything suss... --Nad 20:30, 19 December 2007 (UTC)

Here's the site: http://a2d.apapandreou.net. I have partially resolved the problem (but you may notice that when the folder's are closed you cannot see the folder icon but just the plus symbol). I am just getting it set up so it's still very much in it's first days of experimentation and has virtually no content. I am also using the confirmrequest extension for people to have access so if you need access to see what I am doing you will have to fill in the form (sorry for this: the 50 word bio can just be any text). I am actually very keen on trying to replicate the organicdesign folder structure (including secure spaces) but I gather that requires a number of extensions including the simplesecurity.php extension (and I haven't figured out if the simplesecurity extension is ok for 1.11). Any tips on how to go about this are very welcome. I am a not a programmer and am a self-taught wiki enthusiast so it may take a while for me to catch on. Thanks for your help and your good work. Apap
 * The page source shows that it cannot resolve the path for the folder-closed image. Also, I cannot see any of the images when going to Special:Newimages which means you must have manually placed them into your wiki image structure rather than using the wiki's upload form. The best way is to upload the images normally into your wiki, then specify them in the $wgTreeViewImages array as just the names without any filesystem location info. --Nad 20:58, 21 December 2007 (UTC)
 * Actually I had uploaded using wiki but as bot these were hidden unless you press on "show bot". However, I resolved the problem which was just that I had mistakenly not uploaded the specific gif. Thanks for your help! --Apap 20:58

Changing the treeview width
Hello. I'm pretty new to PHP and mediawiki, so maybe this problem has a simple solution, but I cannot sort it out.

I have treeview working on my website, at rbembedded.com, but I want a wider box than what treeview is showing. I modified the monobook CSS sheet to move the main content to the right, and have the search box expanded (there are other issues to sort out, but it's almost there).

To get treeview wider, I modified the CSS lines for treeview as follows: .tree-view, .tree-view td, .tree-view tr { margin:0; width:180px; padding:0; vertical-align: top; text-align: left; } .tree-view td.tree-text, .tree-view td.tree-text a { font-size:8pt; line-height: 10pt; } .tree-view td.tree-text { padding: 2px 0 0 3px; }

The key point is adding width:180px in the 2nd line. I've tried setting width to 15em, which is what I did in the CSS file. I'm not sure which way is more correct.

The problem is, when the tree is drawn, it is spaced with gaps between the images and the text, resulting in a lot of whitespace. Do I need to update Treeview4.php to change where the images and text are located, or is there a better way to handle this in the CSS? I'd appreciate any help. Thanks.
 * You should be able to get it to work the way you want by only changing css rules, it's best to avoid changing the code-base since all such changes need to be accounted for when upgrading the scripts. You're probably best fixing the sidebar width but letting the tree go as wide or narrow as it needs to, if you need a solid white background, wrap the tree in a div of appropriate width and put the background on that instead. --Nad 03:12, 28 December 2007 (UTC)

CurrentUsers, Treeview4 cannot work fine with Extension:PHPBB/Users Integration
After I installed the PHPBB/Users Integration, I would get some PHP error code about Treeview4 and CurrentUsers

Notice: Undefined variable: bot in D:\AppServ\www\mediawiki-1.11.0\extensions\CurrentUsers\CurrentUsers.php on line 45 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 196 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 105 Notice: Undefined index: node in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 106 Notice: Undefined index: last in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 107 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 105 Notice: Undefined index: node in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 106 Notice: Undefined index: last in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 107
 * Before Login, I saw the code:

Notice: Undefined variable: bot in D:\AppServ\www\mediawiki-1.11.0\extensions\CurrentUsers\CurrentUsers.php on line 45 Notice: Undefined index: vert in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 196
 * After login, I saw the code:

Could you give me a hand?
 * MediaWiki: 1.11.0
 * Win XP
 * The AppServ Open Project - 2.5.7 for Windows
 * Apache Web Server Version 2.2.3
 * PHP Script Language Version 5.1.6
 * MySQL Database Version 5.0.24a
 * phpMyAdmin Database Manager Version 2.9.0.2
 * CurrentUsers (version 1.0.2, 2007-07-26)
 * Treeview4 (version 4.0.8, 2007-10-10)
 * The TreeView4.php Undefined index errors imply that the $wgTreeviewImages array has had the default values removed. What LocalSettings.php code have you added regarding $wgTreeviewImages? --Nad 06:25, 28 December 2007 (UTC)
 * I can't reproduce the currentusers error, do you have the latest version installed? --Nad 06:33, 28 December 2007 (UTC)
 * Thank for your replay. The Treeview setting in my Localsetting.php is like following:

include("$IP/extensions/Treeview4.php"); $wgTreeViewImages['plus']  = '/image/Tree_view_images/Arrow-closed.png'; $wgTreeViewImages['minus'] = '/image/Tree_view_images/Arrow-open.png'; $wgTreeViewImages['opened'] = '/image/Tree_view_images/Folder_opn_sml_blu.gif'; $wgTreeViewImages['closed'] = '/image/Tree_view_images/Folder_sml_blu.gif'; $wgTreeViewImages['doc']   = '/image/Tree_view_images/Doc-icon.gif'; $wgTreeViewImages['spacer'] = '/image/Tree_view_images/Spacer.png';
 * 1) $wgExtensionFunctions[] = 'wfTreeviewAddJS';
 * 2) function wfTreeviewAddJS { $GLOBALS['wgTreeView']->addJS($GLOBALS['wgOut']); }

And the CurrentUser version information is like following image: After all, I thank you for what you done. If I can use treeview, it's enough.

I've made a table. You might want to see and use it. --Roc michael 14:04, 28 December 2007 (UTC)
 * The images problem is as I suspected, change the array settings to the format above so it doesn't delete any existing values from the array. That table looks good, I'll check it out in more detail soon :-) --Nad 19:22, 28 December 2007 (UTC)


 * Nad. Thank you for your reply
 * When I put the code above in the Localsetting.php, I will get the following error code.

Parse error: parse error, unexpected $end in D:\AppServ\www\mediawiki-1.11.0\LocalSettings.php on line 325
 * But there isn't the line 325 in the file.

--Roc michael 02:38, 29 December 2007 (UTC)
 * Sorry missing quote on last item --Nad 02:52, 29 December 2007 (UTC)


 * Nad. After I do it. I meet another problem. I see the following message:

Notice: Undefined variable: wgTreeViewImages in D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php on line 13 Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php:13) in D:\AppServ\www\mediawiki-1.11.0\includes\WebResponse.php on line 10 Warning: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\mediawiki-1.11.0\extensions\Treeview4.php:13) in D:\AppServ\www\mediawiki-1.11.0\includes\WebResponse.php on line 10 --Roc michael 03:04, 29 December 2007 (UTC)
 * You've got your php set to very strict, I've done a small bug fix (4.0.9) which should fix the latest warnings --Nad 05:29, 29 December 2007 (UTC)
 * Nad Thank you, It's work.--Roc michael 06:46, 29 December 2007 (UTC)

Problems on links in tree
Hi there, I like your TreeView. But there are some Problems for me... - when I add just text everything is fine. When I add links   in preview everything is still fine. But when I save the #tree closes right before the first link. Example: SectionA Of course when the brackets are closed the following stuff is not included. Anyone knows how to repair this? btw: I use MW 1.11.0, FireFox, MacOS, MAMP Ben
 * Sorry I haven't come across that problem before, is it the latest treeview version? --Nad 07:02, 28 January 2008 (UTC)

version 4.0.9
--Tepo 21:18, 20 January 2008 (UTC)

I've installed Treeview4, version 4.0.9 on a MW 1.6.10. The code is properly included, the image paths (in the source of the article page) refer to the right locations (the gif files are all there where the paths refer to) and the JS script is included in the source page as expected. But the tree is rendered literally as if it was a standard wiki article and as if the magic word was never acted upon. The icons do not show up; the treeview table is not being defined. From tracing the Treeview4 source code, my impression is that neither function Tree nor function treeview are invoked. It looks as if nothing happens after function Treeview4 has executed. Any suggestions how to resolve this?
 * The # symbol is not implied in some older versions of mediawiki, so you may need to either remove the # from the wikitext, or set $wgTreeView4Magic to "#tree" instead of just "tree" --Nad 06:54, 28 January 2008 (UTC)
 * Solved! Thanks a lot! --Tepo 20:42, 1 February 2008 (UTC)

Treeview not displayed

 * 1) i create file Treeview4.php
 * 2) insert code in localsettings
 * 3) but, if i insert in Mediawiki:sidebar, menu not displayed. in Mediawiki:sidebar i insert example from docs.
 * If you want the tree to work in sidebar, you have to add the skin hack to allow the sidebar article to render wikitext, see Sidebar for more detail about that. --Nad 06:48, 28 January 2008 (UTC)

Treeview suddenly stopped working in Navbar
Hello... we have a very strange problem... there have been no changes to the MediaWiki version or Treeview version, but all of a sudden, insted of the Navbar displaying normally, it is full of lines like this:

UNIQ136a4e0848c93b3c-TreeViewRowStart-00000001-QINUsite�UNIQ136a4e0848c93b3c-TreeViewRowEnd-00000002-QINU �UNIQ136a4e0848c93b3c-TreeViewRowStart-00000003-QINUIntroduction�UNIQ136a4e0848c93b3c-TreeViewRowEnd-00000004-QINU �UNIQ136a4e0848c93b3c-TreeViewRowStart-00000005-QINUHow it works�UNIQ136a4e0848c93b3c-TreeViewRowEnd-00000006-QINU �UNIQ136a4e0848c93b3c-TreeViewRowStart-00000007-QINUScreenshots�UNIQ136a4e0848c93b3c-TreeViewRowEnd-00000008-QINU

See it live here:

http://passwordmaker.org

This is on a shared hosting server (asmallorange) - anyone have a clue what might be causing this?
 * I have no idea why that would suddenly change if no changes were made to any of the code or extensions. I'd recommend upgrading to the latest version as treeview 4 is more reliable code than 3.x. --Nad 06:45, 28 January 2008 (UTC)
 * Never mind - figured it out... !@#$#$^%^ hosting company enabled zend.ze1_compatibility_mode... sorry for the noise.

White block with width 100%
Help please, i integrate treeview in sidebar and edit monobook.css, but all the same i see a white block with width 100%. In ie6 this block down on content.

look:

How delete white block, all resize to necessary size?

PS: I try with width=100% in css - no result.
 * It must be a css problem, try installing firebug into firefox and then right-click and "inspect element" to see what css rules your tree container has had applied to it --Nad 07:27, 8 February 2008 (UTC)

Monobook.css How-to?
Ok, I'm a dummie... so how do I add the Monobook.css stylesheet to our MediaWiki as described so I can change the font size back down to a more reasonable size... which begs the question, why is it so much bigger when going from 3.6 to 4.0.9?

Thanks --
 * Just navigate to your Article MediaWiki:Common.css and there you can change yout css code. Ben --212.184.19.70 07:11, 19 February 2008 (UTC)

MW 1.12+
Any chance this thing is going to work on MW 1.12, PHP 5? Tim Laqua talk 19:55, 28 February 2008 (UTC)
 * Treeview5.x will be made to work with 1.12, we don't have a 1.12 set up to test on yet, what's it doing wrong? --Nad 19:58, 28 February 2008 (UTC)
 * It's all crazy, here's the HTML that results from the parser function example on Organic Design:

&lt;treeview547c711fe2c3f3 id='47c711fe2c3f3' openlevels=4 root='My example tree'&gt;*Node 1 <ul><li><ul><li>Node 1.1 <ul><li>Node 1.1.1 <ul><li>Node 1.1.1.1 </li></ul> </li></ul> </li></ul> </li><li>Node 2 </li><li>Node 3 </li><li>Node 4 </li><li>My Pictures <ul><li>The trip to Iceland </li><li>Mom's birthday </li></ul> </li><li>Recycle bin&lt;/treeview547c711fe2c3f3&gt; </li></ul> I've got a 1.12 install set up to work with now and have worked out a solution which should get it working on 1.12, it should be ready within the next few days --Nad 10:20, 29 February 2008 (UTC)
 * Can I get a quick hack (or some direction) to get it working in the mean time? Tim Laqua talk 13:19, 29 February 2008 (UTC)
 * As soon as I get it working I'll update the code. The parser has undergone massive changes in 1.12 and I've had to work out a different way to do the main parser function. --Nad 02:20, 1 March 2008 (UTC)
 * 5.1.0 is ready and tested fine on 1.11 and 1.12, it's almost a complete rewrite, so there may be some new problems crop up --Nad 21:10, 2 March 2008 (UTC)

Suggestion - add thumbnailing of images
I use the following (from line 63 of Treeview5.php) to transform down to 18px: $image = Image::newFromTitle($title); if ($image && $image->exists) { $thumb = $image->transform( array( 'width' => 18 ) ); $v = $thumb->getUrl; } else { $wgTreeViewImages[$k]; } Tim Laqua talk 21:46, 3 March 2008 (UTC)

Where to put tree list?
The plugin looks great and I'm anxious to use it. However, the latest documentation appears to be missing something:

>>Usage

>>Tree-views are created by surrounding a normal nested bullet list within the following couple of examples:

That's great, but with all of the supporting files for MediaWiki, which one of the hundreds of files do I put this in? I'm assuming it goes in Monobook.php, but I'm not sure. I've tried putting it in both Monobook.php and LocalSettings.php, both of which give me a parse error when it hits the first bullet:

Parse error: syntax error, unexpected '*'

What am I missing here?

Thanks, Scott
 * I'm not quite sure what you mean? are you asking where you put the bullet list? it's wikitext and you put it in the article where you want the tree to be... or are you referring specifically to how to put a tree in the sidebar? if so see Sidebar... otherwise please explain what you're trying to do and what the problem is more clearly. --Nad 04:35, 4 March 2008 (UTC)

Nad - Thanks, you answered my question. I wanted the tree view to be in the Wiki Side Bar, as well as a nav tree once I get to a particular page. I'll take a look at the side bar info and see if I can make the appropriate change(s).

Strange Error
I am getting a javascript error and I am not sure what it means of how to fix it.

invalid flag after regular expression for (i in tree.icon) tree.icon[i] = '/wdev_wiki/extensions/TreeView/'+tree.icon[i];/data/www/mediawiki/extensions/TreeV... ---^

Any ideas? Thanks, Pete.

I figured this out! At line 166 in 'TREEVIEW5_VERSION','5.1.4, 2008-03-05' there seems to be a typo. Line 166 is: for (i in tree.icon) tree.icon[i] = '{$this->baseUrl}/'+tree.icon[i];{$this->images} But should look like: for (i in tree.icon) tree.icon[i] = '{$this->baseUrl}/'+tree.icon[i];

I hope it was a typo and I have not broken something else but it seems to work great now.

Thanks for all your hard work Nad

Proposed Code Change for TREEVIEW5_VERSION 5.1.4 2008-03-05
This change will make arguments passed to each tree render in that tree rather than the last arguments applying to all the trees on a page.

Change Line 150 from $add = isset($args['root']) ? "tree.add(0,-1,'".$args['root']."');" : ''; to: $adds[$id] = isset($args['root']) ? "tree.add(0,-1,'".$this->args[$id]['root']."');" : '';

Change Link 167 from: $add to: $adds[$id]
 * Thanks, good spotting! actually it was a bug in line 148, where


 * needed to be changed to


 * I've updated the code to version 5.1.5 with the bug fixed :) --Nad 20:08, 6 March 2008 (UTC)

Error with Treeview5 & DPL
I am consistently getting

when trying to use DPL in conjunction with Treeview5. This is the code I am trying to use to dynamically create a listing for a Category:

The tree that is being displayed looks like I'd expect, it's just the error that's the issue.

Thoughts on what I'm doing wrong? I'm by no means a DPL expert but that appears to be working OK.

MW 1.11.2 (I was running Treeview 5.1.3 and just saw that you updated to 5.1.5 and tried that with the same results)

aldon
 * Was a typo in the code, try 5.1.6 --Nad 02:01, 8 March 2008 (UTC)
 * Perfect! Thanks,aldon

$wgOut->addScript(...) for adding JS in Treeview5.php produces invalid xhtml
The following is invalid xhtml (and breaks everything until an explicit closing SCRIPT tag is found): <script src="..." /> It needs to have an explicit closing tag: <script src="..." > Tim Laqua talk 02:44, 8 March 2008 (UTC)
 * Thanks, I've added the closing tag --Nad 09:44, 8 March 2008 (UTC)

Internet Explorer 7 not rendering tree view
Hello Nad, I have just installed treeview5 (latest version 5.1.7) and it is working fine on firefox but is not rendering in IE7. Indeed, the same happens when I try viewing pages from organicdesign so it's not related to my installation. The IE error log that show up in the bottom left hand corner says: "object doesn't support this property or method". I have tried this from two different computers. --Apap 18:56, 8 March 2008 (UTC)
 * Thanks for letting me know, I'll see if I can figure out what's up with it asap --Nad 06:02, 9 March 2008 (UTC)
 * Found the problem, in IE the JS object identifier names are not allowed to be the same as element id's --Nad 06:22, 9 March 2008 (UTC)
 * Have you uploaded the new Treeview5.php? Even though the link says 5.1.8 the actual php file still says 5.1.7 inside. I tried it but it has not resolved my IE page renderinng (though organicdesign renders correctly now). Thanks! --Apap 16:54, 9 March 2008 (UTC)
 * Doh - sorry no I hadn't uploaded the 5.1.8 changed - done now :-) --Nad 20:14, 9 March 2008 (UTC)

TreeView not rendering at all
Hi, I updated my MW from 1.9.2 to 1.12.0 and was forced to update TreeView from Version 4 to 5.1.9 therefore, too. Then I discovered that the tree wouldn't be rendered anymore at all. The rest of the page is shown without problems, except an error in the browser. I checked that and found that the problem could be caused using windows as server os. The path is built in windows notation.

part of the browser page source code <script type="text/javascript" src="/wiki/skins/common/wikibits.js?116"> <script type="text/javascript" src="C:\Wiki\xampp\htdocs\wiki\extensions\Treeview5\dtree.js"> <script type="text/javascript" src="/wiki/skins/common/ajax.js?116">

The followng line(57) in treeview5.php causes the problem rendering the path in "C:\Wiki\xampp\htdocs\wiki\extensions\Treeview5": $this->baseUrl = preg_replace('|^.+(?=/extensions)|',$wgScriptPath,$this->baseDir);

The used parameter is set: $wgScriptPath = "/wiki";

I changed your code to the following quick hack and it works now: $this->baseUrl = '/wiki/extensions/Treeview5';

It would be nice if you could check that and give me a quick reply how I should proceed. Thanks in advance. --Chrislee 15:06, 22 March 2008 (UTC)
 * Looks like it is the backslashes in windows which are forward slashes on *nix that are not accounted for in the regular expression. The preg replace would need to be something like

$this->baseUrl = preg_replace('|^.+(?=\\extensions)|',$wgScriptPath,$this->baseDir);
 * to work --Zven 21:56, 22 March 2008 (UTC)

what works for me is the following, slash-agnostic line, not verified on *nix though (--Dannyh 22:06, 25 March 2008 (UTC)): $this->baseUrl = preg_replace('|^.+(?=extensions)|',"$wgScriptPath/",$this->baseDir); I have the same problem, but all of the above workarounds produce an "unterminated string literal" error on the page at this line in the rendered html: for (i in tree.icon) tree.icon[i] = 'D:\Web Applications\DevWiki\extensions\TreeView5\'+tree.icon[i]; Any ideas? --Snuck 02:18, 28 March 2008 (UTC)

OK, by fiddling with our $wgScriptPath, and utilising Zven's solution, dTree.js now loads via <script type="text/javascript" src="/extensions\TreeView5/dtree.js"> and the expand/collapse behaviour now works, but none of the images display. I believe the problem is still with this line in the rendered html: for (i in tree.icon) tree.icon[i] = '/extensions\TreeView5/'+tree.icon[i]; The images are in --Snuck 04:52, 28 March 2008 (UTC)

The only way I could get it to work with the images loading was to change line 70 from $wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"> \n"); to $wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"/extensions/TreeView5/dtree.js\"> \n"); i.e., by hard-coding my baseUrl; otherwise, it is output as The rest of TreeView5.php is as per the OrganicDesign site; i.e., without using any of the above workarounds. This makes no sense to me - it appears that  set in line 57 has a different value when it is used in line 70 from when it is used again in line 181, but I can't see anywhere where its value could be changed. I'll keep looking... --Snuck 00:30, 31 March 2008 (UTC)
 * I suggest another approach (which I haven't tested),  is the problem because it contains a windows path with backslashes instead of forward slashes, and on windows they can be either (http://nz2.php.net/manual/en/function.dirname.php). If you convert these to forward slashes before   (approximately line 59) then the path will be constructed like a unix path.

So change the block to Any feedback on whether this works would be useful. --Zven 00:50, 3 April 2008 (UTC)

I had the problem and it's ok now. Thank you very much. --Teriblus 08:27, 14 April 2008 (UTC)
 * This problem should be fixed in version 5.1.10 --Nad 23:01, 14 April 2008 (UTC)

Experienced the same problem, even when using 5.1.10. Images were not loading, pointing to broken URL when loading: http://mydomain:8080/wikiextensionsTreeview5/img/base.gif

added the baseDir fix above and it works now, points to: http://mydomain:8080/wiki/extensions/Treeview5/img/base.gif --Fpsaceo 14:16, 22 April 2008 (UTC)

Category tree
Hi, Is it possible to mix this extension with the category tree extension ? --Teriblus 08:33, 14 April 2008 (UTC)
 * You can achieve similar results by combining treeview with DPL, see http://semeb.com/dpldemo/index.php?title=Treeview_extension --Nad 22:42, 14 April 2008 (UTC)

No custom icons in 5.1.10
Hi, it seems it's not possible to specify custom icons for single elements in the list. going through the code, it seems that this is not implemented (at least there is no call to method add with a custom icon set). Line 157 would need to be extended to add an icon if needed. will try to investigate this. Jhf2442 21:16, 19 April 2008 (UTC)

Mozilla Dev's are breaking the Sidebar Mod with Firefox and Camino Nightly's
You might want to jump into the discussion here. --Cooknn 15:20, 21 April 2008 (UTC)

Entire site reduced to blank page!!!
Current configuration:


 * MediaWiki:1.12alpha
 * php:5.2.3 (cgi-fcgi)
 * MySQL:5.0.27-log

I have downloaded and install all of the latest files but everytime in include the extension on my site I get a blank page. I comment out the 'require_once' line and all returns to normal. I've checked everything I can think of.

Help Please.......

Blank page after updating treeview5
I updated to latest treeview5 and now my site goes blank. Didn't happen with older versions of treeview5.

--Apap 19:46, 11 May 2008 (UTC)
 * What version of TV5 were you on when it was working? also TV5 is now replaced by TreeAndMenu but I haven't had time to redirect this page and update notes etc. --Nad 21:34, 11 May 2008 (UTC)
 * I was using version 5.1.9. However, I also made an attempted upgrade to mw 1.12 (without updating tables) and then went back to 1.11.2 so I don't know if something went wrong in the process. Unfortunately, I did not save treeview5 ver5.1.9 to check if it works ok. Can I try TreeAndMenu.php? Thanks --Apap 21:49, 11 May 2008 (UTC)
 * I tried TreeAndMenu.php (replacing Treeview5.php but retaining the old name) and it resolves the blank page problem. --Apap 23:37, 11 May 2008 (UTC)

Putting treeview in different place in sidebar
I used the example on the page, problem is I don't want it to go under the toolbox. I want my NavTree to be inplace of the current bullets navigation thing, above my searchbar and I just can't figure it out.

-141.157.90.165 05:44, 14 May 2008 (UTC)
 * You'll probably need to edit your skin file for that, see Manual:Interface/Sidebar for more detail --Nad 10:58, 14 May 2008 (UTC)

Add more than one tree to article?
I am using mediawiki 1.12 on a windows server and there it does not seem to be possible to add more than one tree to one article. The first one gets displayed correctly, but the other ones are empty. Is there any chance to make this work? -- Markus