Extension talk:TreeAndMenu

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 Node 1.1 Node 1.1.1 Node 1.1.1.1    Node 2 </li>Node 3 </li>Node 4 </li>My Pictures The trip to Iceland </li>Mom's birthday </li></ul> </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)

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)

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)

„“== 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.......

Just restart your machine and clean the cache if possible before restarting.

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)


 * This worked great, thanks. Results are at http://www.kill-hannah.com. I'm going to try to arrange the text within the tree a little differently, sorta like you have it on organic design.


 * -141.157.90.165 19:35, 15 May 2008 (UTC)

Small comment, for a large tree you can't entirely control the space it takes up, in this case it is quite convenient to put it in the toolbox location. From memory you can enclose the tree in a; [your tree parser function syntax] However you don't want the nodenames to be to long or they get clipped... --78.49.107.231 23:24, 17 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
 * Looks like a bug has crept in somewhere there, I'll get that fixed as soon as I can --Nad 21:26, 14 May 2008 (UTC)
 * Ok problem should be fixed, try version 1.0.1 --Nad 22:14, 14 May 2008 (UTC)
 * Works, Thanks. -- Markus

Not being displayed in Sidebar
Hi. I installed the TreeAndMenu extension and it works on a normal page but when I edit MediaWiki:Sidebar it doesnt show up on the left side. BTW: I did not modify any css (currently no folder icons are displayed but that is not so important) and to test it I switched to monobook skin using preferences in the wiki interface. I use MediaWiki 1.9.3. When I add $wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfNavTree'; function wfNavTree { global $wgUser,$wgTitle,$wgParser; if (is_object($wgParser)) $psr =& $wgParser; else $psr = new Parser; $opt = ParserOptions::newFromUser($wgUser); $nav = new Article(Title::newFromText('NavTree')); $out = $psr->parse($nav->fetchContent(0,false,false),$wgTitle,$opt,true,true); echo '&lt;/ul>&lt;/div>'.$out->getText; return true; } under the include and I edit the page NavTree I get a tree view under the toolbox but I like to edit the navigation box

Can anybody help me?


 * Ok I found out somebody posted that issue before but I didnt know that I have to edit the skin's php code like said in Wikitext in side bar
 * Thanks anyways
 * Just for those who want to have the same like I was looking for (a tree view in navigation): you dont need the function wfNavTree. Only Wikitext in side bar. 

No tree displayed on page
Used Versions : WindowXP SP2 Mediawiki : 1.12.0 PHP : 5.2.5 MySQL : 5.0.51a TreeAndMenu 1.01

Created page with #tree and #menu

Menu work fine but Tree give an fire fox error console "dTree not defined" Is it possible to have a problem of antislash (\) on different path All modifications or suggestions given in this talk dont work

Note : no tree displayed in sidebar of course

Can anybody help me ? Claude Gillet 20 May 2008
 * It's most likely that the dTree javascript isn't loading. Look at the source of the page and check the path its trying to load dTree.js from. If the site is available on the net let me know the URL and I'll have a look. --Nad 00:03, 21 May 2008 (UTC)

I have pretty much the same problem - I installed it new and nothing is happening...www.goerasmus.eu - I used the standard folders. Thanks! --Jorgusch 13:21, 7 June 2008 (UTC)
 * You haven't added the dTree CSS rules --Nad 20:52, 7 June 2008 (UTC)


 * Thanks for quick response! I am completely new and seriously: I cannot find common.css..the MediaWiki article does not say it either..do you have to create it?? Secondly, you say in the description: 'The style of trees can also be configured purely'- this is a bit irritating. Maybe add to the installation chapter that the standard is defined by adding the code. It seems, I am not the first one not getting it. Thanks! --Jorgusch 14:11, 8 June 2008 (UTC)
 * What version of MediaWiki are you running? version prior to 1.10 used the name of their skin for their CSS article, for example MediaWiki:Monobook.css instead of MediaWiki:Common.css. --Nad 06:37, 10 June 2008 (UTC)
 * I am using 1.12 - I downloaded the package again to check whether I deleted it accidently. What I can find under skins\, respectively skins\common is common_rtl.css and commonPrint.css - that's it. Thanks. --Jorgusch 15:52, 10 June 2008 (UTC)
 * Heureka! wiki is too good..I always thought reading the manual 'modify wiki page MediaWiki:Sidebar' is limited to the mediawiki page, as it appears in the URL..no, it is easier…everything is fine - thanks for the great extension!--Jorgusch 23:33, 11 June 2008 (UTC)

Same problem

 * Hi Nad.
 * I have the same problem. Please see the pictures:




 * My Environment
 * MediaWiki: 1.12.0 (The result in the MW 1.11.0 was the same before I upgraded MW to 1.12.0)
 * Win XP
 * TreeAndMenu 1.0.4, 2008-06-08
 * The AppServ Open Project - 2.5.7 for Windows
 * Apache Web Server Version 2.2.3
 * PHP Script Language Version 5.1.6


 * If you want to know my CSS and javascript setting you may see CSS page and javascript page. --Roc michael 23:16, 7 June 2008 (UTC)
 * Hi Michael, sorry for the delay I didn't notice your post here :-/ That looks like more than a JS problem, can you give me the html source of the problematic page? also your localsettings for treeview would be useful too. --Nad 00:53, 12 June 2008 (UTC)
 * Hi Nad,
 * Thank you for your response. Please see my Localsetting.php and I am finding a way to make my wiki can be accessed by public (now, it can only be accessed by localhost).--Roc michael 15:00, 12 June 2008 (UTC)
 * Try commenting out the entries which set $wgTreeViewImages to see if its working with the defaults that come with dTree. --Nad 22:50, 13 June 2008 (UTC)

Multiple trees failing
Hi Nad A first, thanks very much for your job. To have a good running with this extension i have made a modification in Treeandmenu.php file  because the variable baseurl was not correctly evaluated (i m not a spécialiste but i have seen this in html source code generated). My wiki site is not available because internal factory site (Converteam factory). Please help my because my modification is not standard. More, i have another problem : it is impossible to have several tree on the same page (or/and on sidebar). Finally, is there a solution to place the tree anywhere in the sidbar ? Thanks to reply. CGT 01/06/08
 * What you want is a way to overide the property for the instance of the TreeandMenu class from something you put in the LocalSettings.php without having to hardcode anything into the extension itself, this gives your code independence of any further developments.


 * More than one tree can be added to an article at any time, the code automatically allows this, there is an option id= which if specified makes the trees current state persistent sing cookies, to test this, open up two browser tabs of the same article with a persistent tree on it, modify the state of the tree on one article, then reload the other articles in the other tab --Zven 23:32, 31 May 2008 (UTC)


 * Thanks for your quick answer. Unfortunately, my poor english dont permit me to understand all very well.
 * So at first, is my modification on baseurl valid ? and why the original code dont work in my configuration
 * Second how i use exactly the "id" option because my test dont work (same id for all tree ...)give me an exemple please
 * for the place of the tree on the sidebar i must test again relatively to talk above
 * Thanks verry much CGT 01/06/08
 * Not sure what the problem is with your localhost setup, there appears to be a mistake in your code  should have been   ://....

However thebaseUrl variable is a relative path to the treeview directory, not an absolute path; The id option jsut adds a unique tag to the GUIDs for each tree. See my working example, making two windows of the same article, then manipulating one and pdating the other using browser refresh should update the other. --Zven 00:51, 1 June 2008 (UTC)

Hi Nad, Zven I confirme that in my configuration, it is impossible to have more than one tree in article. In detail, the render of the first tree is OK but not for the second (no tree). Effectively, the generated HTML code is not correct (only one tree appear. In fact it is more complicated. The behaviour is very courious. The second tree work well until i add an item in the first tree (the second tree disappear!). The same thing with three tree, the add of one item in the first tree disappear the second but not the third. In your opinion, is it a problem with my configuration (or utilization) or a bug in treeandmenu ? Note : your exemple in organicdesign don't use more than one tree. Have a concret exemple with several tree ? Note : my error console indicate and

Please can you help me because the use of treeandmenu is fundamental for me. Claude Gillet 04 june 2008
 * Can you give me a URL of the site? if if not public, add the wikitext source and the html source of the problem page to my talk page and I'll take a look --Nad 13:14, 4 June 2008 (UTC)
 * Ok I've found the problem, update from SVN and your multiple trees should be working now --Nad 01:21, 5 June 2008 (UTC)

Hi Nad

Thanks for your reactivity. The Multi tree work now well but : is always in my error console
 * it is impossible to use the option (root=, id=, ...) because trees disappear
 * The message

In exchange to your work, i propose to complete the extension documentation to have more explanations for the newby

Regards. CGT 05/06/08
 * I'm not getting that problem on any of my wiki's, can you give me the html source of the page giving such notices? --Nad 00:47, 12 June 2008 (UTC)

I got the same problem with having no images @ TreeView while menus were working great. The problem was that the string containg image directory was worng ("\" instead of "/"). So open the TreeAndMenu.php and add "$this->baseDir = preg_replace('|\\\|', "/", $this->baseDir);" AFTER the exsisting content: "$this->baseDir = dirname(__FILE__);"

Customizing width and position
Hi. Thanks for your work. Question: Are there parameters like width so I can pass in the template a different width according to the particular tree? This is relevant for example if your tree is on the right part of the page. And same for position? - 22.05.08
 * Give your tree an id parameter and then you can address it specifically in your CSS --Nad 21:14, 22 May 2008 (UTC)

Customizing the root
Hi. I could not find a way to add a mediawiki link in the top root? Like

Thanks - 22.05.08
 * bug fixed, root parsed as wikitext properly now --Nad 13:58, 4 June 2008 (UTC)


 * Thanks Nad. However in my case it breaks the tree (I have tidy enabled); with a wiki link I see in the source

tree.add(0,-1,'<a href=\"/Test\" title=\"Test\">Test</a>     &lt;!-- Tidy found serious XHTML errors --&gt;      ');
 * Same error w/o a link in the root

tree.add(0,-1,'Test     &lt;!-- Tidy found serious XHTML errors --&gt;      ');
 * Regards, JdV 08.06.08
 * My bad :-/ I should be surrounding my JS script in CDATA and comment syntax, try the latest version which shouldn't have anything "untidy" in it... --Nad 06:26, 8 June 2008 (UTC)
 * Thanks Nad. I still get the same error message though. The tree will only be displayed if I leave the root blank (root=|). Could it be that an EOL or another funny character is in at the end of $args['root']? How does your source code looks (w/o tidy?)? Do you also have a break after the link|plain name and before the string closing? Regards, JdV 08.06.08
 * Maybe I should add, I am on MW 1.11. Thanks, JdV
 * I've fixed the problem, but have temporarily lost commit access so I can't update the changes on the SVN. If you'd like to add the patch yourself, go to the block of code that has the line $p = clone $parser (just search for clone), and replace that block with this one:


 * Nad, Per.fect. Both cases, with or w/o mediawiki markup, work now. A BIG THANKS!!!. JdV 17.06.08
 * No problem :) glad to hear it worked - I got my commit access sorted out, so its up to date on svn now too. --Nad 06:16, 18 June 2008 (UTC)

Remove the root
How can I remove the "root line" and icon completely as in the example on the DPL website?
 * Set the root image to nothing in your localsettings, $wgTreeViewImages['root'] = "" --Nad 22:04, 3 June 2008 (UTC)

I set the root image to nothing like said above. But instead of removing completely there are an icon with a red 'X' in it. How can I remove this icon? I hope, someone can help me.

Special pages in toolbox broken
I installed TreeAndMenu and the trees and menus are rendering fine but now when I click on "Special pages" in the toolbox I get the following error message:

Fatal error: Cannot redeclare wfsetuptreeandmenu (previously declared in /var/www/wiki/extensions/TreeAndMenu/TreeAndMenu.php:259) in /var/www/wiki/extensions/TreeAndMenu/TreeAndMenu.php on line 261

Can you help?
 * Are you sure you haven't done the include of the tree from more than one place? does your site have a public URL I can see it from? --Nad 06:38, 10 June 2008 (UTC)

Long Tree Items
Hi Nad. I have a few trees working now, Thanks. The new one contains long item names which I can't change; FAQ questions. Even after adapting them to a "short" name, they would take maybe two or three 250px lines. Any ideas how I can render them in the tree? Thanks - JdV 18.06.08
 * Sorry I can't see a simple way of allowing multiple lines currently, I've had this problem as well and haven't found a practical solution yet. --Nad 23:16, 18 June 2008 (UTC)
 * Hi; any news on this? I was asked by a friend to help her setting a page with a menu and she has many longer items which we cannot figure out how to shorten them. I tried some tricks to create a new line without the icon image but I was not successful... Many thanks - JdV 06.11.08

Versions:

 * MediaWiki 1.12.0
 * PHP 5.2.5 (apache2handler)
 * MySQL 5.0.45-community-nt
 * TreeAndMenu (Version 1.0.6, 2008-06-25)

Source code in Internetexplorer 7
<script type="text/javascript">/*<![CDATA[*/ // TreeAndMenu1.0.6, 2008-06-25 tree = new dTree('tam486d2bb0aa833'); for (i in tree.icon) tree.icon[i] = '/mediawiki/extensions/TreeAndMenu//'+tree.icon[i]; tree.config.useLines = false; tree.add(0,-1,''); tam486d2bb0aa833 = tree; tam486d2bb0aa833.add(1, 0, 'Root1'); tam486d2bb0aa833.add(2, 1, 'Sub-item'); tam486d2bb0aa833.add(3, 1, 'Another sub-item'); tam486d2bb0aa833.add(4, 0, 'Root2'); tam486d2bb0aa833.add(5, 4, 'Sub-item'); tam486d2bb0aa833.add(6, 4, 'Another sub-item'); document.getElementById('486d2bb0aa833').innerHTML = tam486d2bb0aa833.toString; /*]]>*/ http://localhost/mediawiki/extensions/TreeAndMenu//img/folder.gif
 * (Ver 7.0.5730.13 WIN XP SP3)
 * which gives a complete and functional satisfying tree, in stead of "//" before "img" included within the path, tree including images and text is operating

Source code as rendered by Firefox 3
<script type="text/javascript">/*<![CDATA[*/ // TreeAndMenu1.0.6, 2008-06-25 tree = new dTree('tam486d293230452'); for (i in tree.icon) tree.icon[i] = 'http/localhost/mediawiki/extensions/TreeAndMenu/'+tree.icon[i]; tree.config.useLines = false; tree.add(0,-1,'Organic Design'); tam486d293230452 = tree; tam486d293230452.add(1, 0, 'Root'); tam486d293230452.add(2, 1, 'Sub-item'); tam486d293230452.add(3, 1, 'Another sub-item'); document.getElementById('486d293230452').innerHTML = tam486d293230452.toString; /*]]>*/ http/localhost/mediawiki/extensions/TreeAndMenu/img/folder.gif
 * (Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9) Gecko/2008052906 Firefox/3.0)
 * which includes a not working image path, finally nothing is shown, no images, no text, no tree
 * possibly bevcause of  http/local....  in stead of  http://local... 

Solution
??? Please advice how to proceed or where I made a mistake. Thank you.
 * The problem is definitely the "http/localhost", what are your LocalSettings tree config entries? --Nad 21:23, 3 July 2008 (UTC)

I did not know about "LocalSettings tree config entries", I just followed the installation instruction and added the one line info localsettings

actual workaround:

1.) Added into LocalSettings.php (additionally towards the installation described above)

2.) Added into TreeAndMenu.php after the line (app. 65)

thus corrupting your intended regular expression, but actually this leads towards the intended results

Menu working but not the Tree View !!
I have unzipped the contents to the Extensions folder. which has under D:\xampp\htdocs\mwiki\extensions\TreeAndMenu, now i have
 * the img folder
 * TreeandMenu.php
 * dscript.js
 * Extensions.php

I have added dtree.js and css contents to mediawiki:Common.js & mediawiki:Common.css. Then in Local settings i have: require_once("$IP/extensions/TreeAndMenu/TreeAndMenu.php"); $wgTreeViewImages = "http://localhost/mediawiki/extensions/TreeAndMenu/img"; $wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfNavTree'; function wfNavTree { global $wgUser,$wgTitle,$wgParser; if (is_object($wgParser)) $psr =& $wgParser; else $psr = new Parser; $opt = ParserOptions::newFromUser($wgUser); $nav = new Article(Title::newFromText('NavTree')); $out = $psr->parse($nav->fetchContent(0,false,false),$wgTitle,$opt,true,true); echo '</ul> '.$out->getText; return true; }

can any one guide me where i went wrong ?? ---Yantra 74 19:49, 5 July 2008 (UTC)
 * Please supply more information about the problem, what is it doing wrong? is it online? if not I'll need to see the html source code of a page with an incorrect tree in it. --Nad 12:16, 18 July 2008 (UTC)

Reply
This problem haunts also me since previous versions of this extension. I found a fix http://www.mediawiki.org/wiki/Extension_talk:Tree_view#TreeView_not_rendering_at_all --78.84.40.40 14:13, 4 December 2008 (UTC)

Links Break Tree
I am having same issue as Ben above. Tree renders correctly if no brackets (links) are included. At save }} are being inserted before the brackets. After save, text from the first link backwards appears as }} or as a link and then a }}
 * I am using MW 1.12, Opera, Ubuntu Linux. Installed extensions are AutoLink, Cite, FCKeditor (but this issue appears even if I disable FCKeditor), HeaderTabs, HTMLets, ReplaceText, Semantic Forms, SemanticMediawWiki, TreeAndMenu, FaviconLink. I downloaded the latest version of extension today.


 * Solved: Apparently caused by AutoLink extension (using version 2.3 by Virgil Green). I resolved it by adding:

"", to the AutoLink.php file under the lines autoLinkWords array (

Implementation of openlevels parameter
I really needed the openlevels parameter to work for a tree. So, here is my implementation. It is working fine on my MediaWiki 1.12.0. The differences shown below is with respect to TreeAndMenu version 1.0.6, 2008-06-25.

diff -r TreeAndMenuR36999/TreeAndMenu.php TreeAndMenu/TreeAndMenu.php 180a181 >                        $opennodes = array; 189a191 >              $openlevels  = (isset($args['openlevels']) ? $args['openlevels'] : 1) + 1; 194,195c196,201 <              if ($type == 'tree') $nodes .= "$objid.add($node, $parent, '$item');\n"; <              else { --- >              if ($type == 'tree') { >                                        $nodes .= "$objid.add($node, $parent, '$item');\n"; >                                        if (($depth > 0) && ($openlevels > $depth)) { >                                            $opennodes[] = $parent; >                                        } >               } else { 219a226,229 >                                                $opennodesjs = ''; >                                                foreach (array_unique($opennodes) as $value) { >                                                    $opennodesjs .= "$objid.o($value);\n"; >                                                } 229a240 > $opennodesjs Andrea 23:38, 29 July 2008 (UTC)
 * Awesome, thanks a lot! I've been wanting that functionality for ages but haven't had the time to check it out. I've modified the patch slightly and updated it on svn. --Nad 00:19, 31 July 2008 (UTC)

Beginners Problems
I use

on a Windows 2003 sp1

MediaWiki 1.13.0 PHP 5.1.2 (isapi) MySQL 5.0.51a-community-nt-log

Parser-Hooks TreeAndMenu (Version 1.0.7, 2008-07-31) monobook - skin

Major Problem A (Treeview .. no icons...
At first i created a new page where i put

but there are no icons shown... the reason is that the path to the icon ... there are not slashes

Major Problem B (... escape characters in the link... )
if I use menu

the link look like %22/wiki2/index.php?title=test:OffenePunkte&action=edit&redlink=1\" on the front there is a %22 and on the End there is a \"

in the html source there is the following

== > Solution

before this line $nodes .= "<li class=\"$class\">$item";

Insert

$item = str_replace("\\","",$item);

Major Problem c
i tried to want to use ... "Adding a treeview to the sidebar (if using monobook skin)"

== > Problem solved http://www.mediawiki.org/wiki/Manual:Interface/Sidebar#Allow_wiki_markup_.28PHP.29

but it didn't work (no treeview)

i also tried to put the treeview .. at the MediaWiki:Sidebar - Page also no treeview... at the sidebar .. but in the mediawiki:sidebar Page

also dynamic tree doesn't work

if I use

only the line is shown!

thx!
 * Did you install the DPL extension? --Nad 11:28, 29 August 2008 (UTC)

Saving tree status between page transitions
Is there a way to save the status of the tree to save the current leaf unfolded, instead of the tree folding everytime the user clicks a link?
 * Yes, just add an id parameter to your tree so that it can be uniquely identified --Nad 06:03, 5 November 2008 (UTC)

I would like to do this too - where does the id parameter go? I tried adding one to the NavTree page and it didn't do anything other than breaking the tree functionality. Do you need 1.08 to do this? We're running 1.07 (but the guy who's working with me will upgrade us to 1.08). Have looked for clear instructions on how to implement persistence to no avail. Thanks! VIngogly 15:41, 19 December 2008 (UTC)

Don't include <tt>id=</tt> in transcluded sub-trees
I've noticed trees won't render if they have transcluded sub-trees that contain their own <tt>id=</tt> clause. The documentation doesn't make mention of that, so I thought I'd share. --Jeffreykennedy 19:53, 18 November 2008 (UTC)

Not JS output
i've installed this extension correctly:

MediaWiki 	1.12.0, PHP 	5.2.0-8+etch13 (apache2handler), MySQL 	5.0.32-Debian_7etch8-log

but this is the output of:

1tam494bdf426eeec494bdf42846b20Root12tam494bdf426eeec

1tam494bdf426eeec494bdf42846b21Sub-item2tam494bdf426eeec

1tam494bdf426eeec494bdf42846b21Another sub-item2tam494bdf426eeec

1tam494bdf426eeec494bdf42846b20Root22tam494bdf426eeec

1tam494bdf426eeec494bdf42846b21Sub-item2tam494bdf426eeec

1tam494bdf426eeec494bdf42846b21Another sub-item2tam494bdf426eeec

? 77.21.174.72 18:06, 19 December 2008 (UTC)