Extension talk:TreeAndMenu

From mediawiki.org

[SOLVED] Root is not displayed[edit]

MW : 1.35.2 / PHP 7.4 / T&M : 4.2.5
Issue : root is not displayed with the following code.

{{#tree: id=siteTree | class=navTree | root=Organic Design |
*Item
**[[Sub-item link]]
**Another sub-item
}}

Solution : put the following css code

.fancytree .root p {
	display: inline;	
}

after the .fancytree p input.

NB : It could be a good idea to use Structured Discussions for this huge discussion page. ;-)
--Megajoule (talk) 16:49, 15 November 2021 (UTC)Reply

Hints for Getting Current Version Running[edit]

29 July 2013:

Click on the "Download Zip" link, right side. Open the .zip file and save the TreeAndMenu folder beneath the extensions folder of your wiki (/var/lib/mediawiki/extensions, for Ubuntu).
Direct link to zip download: https://github.com/OrganicDesign/extensions/archive/git-svn.zip
  • The require_once() must appear before Graphviz in your LocalSettings.php if you're using Graphviz. Failing to do this will result in the magic work #tree: being completely ignored.

I have had no luck getting menus to work. Putting

{{#menu: 
*menu1
*menu2
**menu2sub
*menu3
}}

simply appears on the page. If anyone has success with this please post here!

Download link not working[edit]

How to download this extension.Any download links not working.

The download link is broken. The link to the SVN works, but I don't know how to download the TreeAndMenu directory.

Solution: read instructions here https://www.organicdesign.co.nz/Guest_RSA_key
   Above solution not opening.

no download file available[edit]

I can not find the files from Special:ExtensionDistributor/TreeAndMenu. Have them been removed?

Has this been solved? - I can not find the download!

In addition to that, I don't see how to download the files from OrganicDesign's websvn site as a group; they can only be downloaded one at a time. There's probably some way to do it using svn from a command line, but it's not at all clear how to do that. --Woozle (talk) 20:26, 23 March 2013 (UTC)Reply
After consulting with some people more geeky than I, it was determined that the following command works:
svn checkout http://extensions.organicdesign.co.nz/svn/extensions/TreeAndMenu/
    Error: svn: 'http://extensions.organicdesign.co.nz/svn/extensions/TreeAndMenu' path not found
There should be instructions here mentioning this, and the WebSVN deployment at OrganicDesign really should be fixed to provide a download link. --Woozle (talk) 13:02, 24 March 2013 (UTC)Reply
Yup I cannot download at work because SVN is not allowed... Now downloading each file manually... hmm please create a download link!!

Treeview not displayed in wiki 1.18[edit]

http://www.mediawiki.org/wiki/Special:ExtensionDistributor/TreeAndMenu
1.18
Download MediaWiki extension
Invalid response from remote subversion client.

downloaded http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/TreeAndMenu/ as an alternative

TREEANDMENU_VERSION','2.0.4, 2012-03-03'

DOES NOT WANT TO GET IN THE SIDE BAR

  • {{#tree: ==> NOK .....Not in side bar
  • {{#menu: ==> Ok(soso) ......... in sidebar only one level

Nesting Menu with Tree

Probably more of a feature request but would be nice to be able to handle for example

  {{tree:root=Home|
  *First Page
  *{{menu:root=Second Page|
  *Second-Sub1
  *Second-Sub2
  **Second-Sub2Sub1
  **Second-Sub2Sub2
  *Second-Sub3
  }}
  *Third Page
  **Third-Sub1
  }}

Appears not to be compatible with MediaWiki 1.17.0 (This is the HACK to make it work)

Script line 86 in TreeAndMenu.php which uses addScript-function does not work anymore. Has to be changed to:

 $wgOut->addHeadItem( "test","<script type=\"$wgJsMimeType\" src=\"{$this->baseRelDir}/dtree.js\"></script>\n" );

Otherwise the dtree.js-script is rendered AFTER the tree-js-codes, so error message "dtree-object not defined" will appear. --Pianorob 14:59, 23 July 2011 (UTC)Reply

Or even nothing at all with no apparent error. --190.135.54.74 19:02, 3 October 2011 (UTC)Reply
THIS IS THE HACK, thanks a lot Pianorob, this is indeed not 1.17.0 compatible --190.135.54.74 18:53, 3 October 2011 (UTC)Reply
If there is a hack for this please divulge.

Goldbishop 18:26, 12 July 2010 (UTC)Reply

THIS IS THE HACK, thanks a lot Pianorob, this is indeed not 1.17.0 compatible --190.135.54.74 18:53, 3 October 2011 (UTC)Reply

Duplicating page TOC

Any tips for using this extension to duplicate a page's TOC? --Two7s clash 17:31, 17 April 2010 (UTC)Reply

How to insert #menu into a <Div>

I installed your extension TreeAndMenu. I have build a page with the #menu function with 3 sublevels. Displaying the menu or tree in the sidebar is no problem, but now I want to show the menu in a div-tag. Is there any way to do that? I would be thankfull for a solution.

best regards

--Crumpet 13:48, 17 February 2010 (UTC)Reply

Bug Fix for Tree not display

I found some bug in TreeAndMenu.php. It will generate a worinag javasciptr path. Find this code:

 $wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>\n");

Replace as

 $wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"{$wgScriptPath}/extensions/dtree.js\"></script>\n");

If your extensions path not default Replace as :

  $wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"{$wgScriptPath}{YoutExtendPath}/dtree.js\"></script>\n");
Tried all this and did not work for 1.17.0 Mediawiki, the problem is that it has to be in the header, thanks a lot Pianorob for the solution a few posts above here, this is indeed not 1.17.0 compatible --190.135.54.74 18:53, 3 October 2011 (UTC)Reply

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: {{#tree: *Root **}} 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)Reply


I also have the above problem

same problem as above. i'm using latest version of treeview from SVN on MW 1.14. plz help

Jack

I also have the above problem

same problem as above. i'm using latest version of treeview from SVN on MW 1.15.1.

I Thimk that there is a problem in the editor parser. When using Wikitext like [, [[, {{ the closing }} are added bevor the Wikitext. I would be thankfull for a solution.

Joerg Wiemann

version 4.0.9

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

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)Reply
Solved! Thanks a lot! --Tepo 20:42, 1 February 2008 (UTC)Reply

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

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


You probably hadn't placed

<div class="portlet"> ... </div>

around the trees in the sidebar. This would cause the error you describe. (See Manual:Interface/Sidebar#Content of MediaWiki:Sidebar). I had this same problem when I upgraded from TreeView4.

--Niskitonf 18:58, 20 October 2009 (UTC)Reply

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

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

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)Reply
It's all crazy, here's the HTML that results from the parser function example on Organic Design:
</p><p><treeview547c711fe2c3f3 id='47c711fe2c3f3' openlevels=4 root='My example tree'>*Node 1
</p>
<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</treeview547c711fe2c3f3>
</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)Reply

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

Use cookies?

I'm back on tree now and working on custom images and persistence --Nad 00:58, 3 October 2007 (UTC)Reply
Persistence is now available via cookies in version 5.x.x --Zven 23:01, 10 March 2008 (UTC)Reply

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

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#Wikitext in side bar... otherwise please explain what you're trying to do and what the problem is more clearly. --Nad 04:35, 4 March 2008 (UTC)Reply

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
    $args = $this->args[$root];
needed to be changed to
    $args = $this->args[$id];
I've updated the code to version 5.1.5 with the bug fixed :) --Nad 20:08, 6 March 2008 (UTC)Reply

Error with Treeview5 & DPL

I am consistently getting

Notice: Undefined index: in /hermes/bosweb/ ... /public_html/wiki/extensions/Treeview5/Treeview5.php on line 132

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:

{{#tree:
*Articles in [[:Category:Service]]
{{#dpl:category=Service|format=,**,[[%NAME%]]\n,}}
}}

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)Reply
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="..." ></script>

Tim Laqua talk 02:44, 8 March 2008 (UTC)Reply

Thanks, I've added the closing tag --Nad 09:44, 8 March 2008 (UTC)Reply

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

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)Reply
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)Reply
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)Reply
Doh - sorry no I hadn't uploaded the 5.1.8 changed - done now :-) --Nad 20:14, 9 March 2008 (UTC)Reply

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>
<script type="text/javascript" src="C:\Wiki\xampp\htdocs\wiki\extensions\Treeview5\dtree.js"></script>
<script type="text/javascript" src="/wiki/skins/common/ajax.js?116"></script>

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

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

what works for me is the following, slash-agnostic line, not verified on *nix though (--Dannyh 22:06, 25 March 2008 (UTC)):Reply

 $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)Reply

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"></script>

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 /extensions/TreeView5/img --Snuck 04:52, 28 March 2008 (UTC)Reply

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\"></script>\n");

to

$wgOut->addScript("<script type=\"$wgJsMimeType\" src=\"/extensions/TreeView5/dtree.js\"></script>\n");

i.e., by hard-coding my baseUrl; otherwise, it is output as /extensions\TreeView5/ 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 $this->baseUrl 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)Reply

I suggest another approach (which I haven't tested), $this->BaseDir 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 $this->baseUrl = preg_replace('|^.+(?=/extensions)|',$wgScriptPath,$this->baseDir); (approximately line 59) then the path will be constructed like a unix path.

So change the block

	# Update general tree paths and properties
		$this->baseDir  = dirname(__FILE__);
		$this->baseUrl  = preg_replace('|^.+(?=/extensions)|',$wgScriptPath,$this->baseDir);

to

		# Update general tree paths and properties
		$this->baseDir  = dirname(__FILE__);
                $this->baseDir =  preg_replace('|\\\|', "/", $this->baseDir);
		$this->baseUrl  = preg_replace('|^.+(?=/extensions)|',$wgScriptPath,$this->baseDir);

Any feedback on whether this works would be useful. --Zven 00:50, 3 April 2008 (UTC)Reply

I had the problem and it's ok now. Thank you very much. --Teriblus 08:27, 14 April 2008 (UTC)Reply

This problem should be fixed in version 5.1.10 --Nad 23:01, 14 April 2008 (UTC)Reply

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

Category tree

Hi, Is it possible to mix this extension with the category tree extension ? --Teriblus 08:33, 14 April 2008 (UTC)Reply

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

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


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

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

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

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

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;

<div class="pBody">
[your tree parser function syntax]
</div>

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

How to hide navigation box: treeview tied to navigation box???

With Mediawiki 1.13, I have tried to hide the navigation box, or at least set it below the navigation tree.

But NavTree display seems to be tied to the navigation box: whether I try to remove the navigation box from monobook.php or monobook.css, NavTree keeps vanishing.

Any idea how to proceed to solve this? Thanks in advance.

CSS tree styles

Pb: different styles if logged in or not

With Mediawiki 1.13 / Monobook, The style I chose for NavTree only applies after I log in.

Though I have not set up any CSS rule of that kind, only the lines indicated on the extension main page.

Any idea how to proceed to solve this? Thanks in advance.

I'm seeing the same exact problem. I implemented the menu on the sidebar and it's fully expanded without any css applied when users are logged out, but works fine when people are logged in. --Gkullberg 15:20, 3 September 2009 (UTC)Reply

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)Reply
Ok problem should be fixed, try version 1.0.1 --Nad 22:14, 14 May 2008 (UTC)Reply
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 '</ul></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.
use: $nav = new Article(Title::newFromText('MediaWiki:NavTree')); (Pieter, august 2011)

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

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

You haven't added the dTree CSS rules --Nad 20:52, 7 June 2008 (UTC)Reply
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)Reply
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)Reply
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)Reply
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)Reply

Same problem

Hi Nad.
I have the same problem. Please see the pictures:
Firefox
MS IE
  • 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)Reply
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)Reply
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)Reply
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)Reply
I think this has been fixed on rev:52471. Shinjiman 18:02, 26 June 2009 (UTC)Reply

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 $this->baseUrl = 'http/localhost/mediawiki/extensions/TreeAndMenu'; 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)Reply
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 $this->baseUrl = 'http/localhost/mediawiki/extensions/TreeAndMenu' should have been $this->baseUrl = 'http://....

However thebaseUrl variable is a relative path to the treeview directory, not an absolute path;

    var $baseUrl  = '';      # external URL to treeview directory (relative to domain, not absolute)

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

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

"Avertissement : reference to undefined property this._p Fichier source : http://localhost/mediawiki/extensions/TreeAndMenu/dtree.js Ligne : 54" and

"Erreur : tam484667cc6a7cb is not defined Fichier source : http://localhost/mediawiki/index.php/Essai Ligne : 109"

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)Reply
Ok I've found the problem, update from SVN and your multiple trees should be working now --Nad 01:21, 5 June 2008 (UTC)Reply

Hi Nad

Thanks for your reactivity. The Multi tree work now well but :

  • it is impossible to use the option (root=, id=, ...) because trees disappear
  • The message
    Avertissement : reference to undefined property this._p Fichier source : http://localhost/mediawiki/extensions/TreeAndMenu/dtree.js Ligne : 54
    

is always in my error console

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

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)Reply
Hi, what exactly do you mean with a different tree id and address it in CSS? I'm sorry, but i am not too skillful in CSS. Tks - Diego

Customizing the root

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

{{#tree:root=MyRoot|Internal_Link_to_My_Root|
*My First Bullet
}}

Thanks - 22.05.08

bug fixed, root parsed as wikitext properly now --Nad 13:58, 4 June 2008 (UTC)Reply
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>
     <!-- Tidy found serious XHTML errors -->
     ');
Same error w/o a link in the root
     tree.add(0,-1,'Test
     <!-- Tidy found serious XHTML errors -->
     ');
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)Reply
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:
if (isset($args['root'])) {
	$p = clone $parser;
	$o = clone $parser->mOptions;
	$o->mTidy = $o->mEnableLimitReport = false;
	$html = $p->parse($args['root'], $parser->mTitle, $o, false, true)->getText();
	$args['root'] = addslashes($html);
}
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)Reply

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

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.

In addition to Nad's suggestion, you could also add a conditional to the dtree.js file:

Find:

        str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';

Replace with:

        //Hiding root node if empty (removing the image gracefully if not set via:
        //$wgTreeViewImages['root'] = "";

        if (node.icon != ""){
            str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
        }
This will avoid the image error icon (tested with FF3, IE8 and MW 1.16). This works for my purposes, I have not tested with all the possible reconfigurations of this extension. -Cedarrapidsboy 20:50, 17 June 2010 (UTC)Reply

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

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

Firefox 3 problem

Versions:

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

Mediawiki-Code:

{{#tree:
*Root1
**Sub-item
**Another sub-item
*Root2
**Sub-item
**Another sub-item
}}

Source code in Internetexplorer 7

  • (Ver 7.0.5730.13 WIN XP SP3)
<div class='dtree' id='486d2bb0aa833'>
<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();
/*]]>*/</script>
</div>
  • which gives a complete and functional satisfying tree, in stead of "//" before "img" included within the path, tree including images and text is operating
http://localhost/mediawiki/extensions/TreeAndMenu//img/folder.gif

Source code as rendered by Firefox 3

  • (Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9) Gecko/2008052906 Firefox/3.0)
<div class='dtree' id='486d293230452'>
<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();
/*]]>*/</script>
</div>
  • which includes a not working image path, finally nothing is shown, no images, no text, no tree
http/localhost/mediawiki/extensions/TreeAndMenu/img/folder.gif
  • 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)Reply

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

  • include("$IP/extensions/TreeAndMenu/TreeAndMenu.php");

info localsettings

actual workaround:

1.) Added

  • $wgTreeViewImages = "http://localhost/mediawiki/extensions/TreeAndMenu/img";

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

2.) Added

  • $this->baseUrl = '/mediawiki/extensions/TreeAndMenu/';

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

  • $this->baseUrl = preg_replace('|^.+(?=[/\\\\]extensions)|', $wgScriptPath, $this->baseDir);

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></div>'.$out->getText();
return true;
}

can any one guide me where i went wrong ?? ---Yantra 74 19:49, 5 July 2008 (UTC)Reply

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

Reply

This problem haunts also me since previous versions of this extension. I found a fix Extension talk:Tree view#TreeView not rendering at all --78.84.40.40 14:13, 4 December 2008 (UTC)Reply

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:
"{{#tree:", "}}", 

to the AutoLink.php file under the lines

autoLinkWords 
array (

Implementation of openlevels parameter[edit]

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

Beginners Problems[edit]

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...[edit]

At first i created a new page where i put

{{#tree: *A **A1 **A2 ***A21 ***A22 **A3 *B }}

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... )[edit]

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 <ul class='dmenu' id='48b7d0445fc78'> <li class="even"> <a href=\"/wiki2/index.php?title=test\" title=\"LagNexus\">LagNexus</a> <ul> <li class="even"> <a href=\"/wiki2/index.php?title=test:OffenePunkte&action=edit&redlink=1\" class=\"new\" title=\"test:OffenePunkte (Seite nicht vorhanden)\">Offene Punkte</a></li> </ul> </li> </ul> <script type="text/javascript">/*<![CDATA[*/ if (window.attachEvent) { var sfEls = document.getElementById('48b7d0445fc78').getElementsByTagName('li'); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=' sfhover'; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(' sfhover *'),''); } } } /*]]>*/</script> </p> </div>


== > Solution

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

Insert

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

Major Problem c[edit]

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

== > Problem solved 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

{{#tree: *Articles in [[:Category:Main]] {{#dpl:category=Main|format=,**,[[%PAGE%]]\n,}} }}

only the line {{#dpl:category=Main|format=,**,[[%PAGE%]]\n,}} is shown!

thx!

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


Major Problem D (.:. Another problem with escape characters in the link .:. )[edit]

if I use menu

the link look like http://192.168.0.2/%22/t3wiki/index.php/T3/%22 "after the direction ip is a %22/ and on the End there is a %22"

in the html source there is the following

<ul class='dmenu' id='4b85512a7984a'> <li class="even">Introducción <ul><li class="even"><a href=\"/t3wiki/index.php/T3\" title=\"T3\">T3</a></li> <li class="odd">T3Wiki</li> </ul></li><li class="odd">Funciones básicas <ul><li class="even">Ingreso a T3Web</li> <li class="odd">Interfaz de usuario T3Win</li> <li class="even">Interfaz de usuario T3Web</li> <li class="odd">Notificación de cambios</li> <li class="even">Actualización de T3Win</li> <li class="odd">Cambio de contraseña T3Win</li> <li class="even">Cambio de contraseña T3Web</li> <li class="odd">Reporte de fallas</li> </ul></li><li class="even">Modulos <ul><li class="even">Ventas <ul><li class="even">Vendedores</li> <li class="odd">Zonas de venta</li> <li class="even">Clientes</li> <li class="odd">Rutas de visita</li> <li class="even">Pedidos</li> <li class="odd">Cuotas de venta</li> <li class="even">Estadísticas de venta</li> <li class="odd">Lista de precios</li> <li class="even">Reporte de actividades</li> </ul></li><li class="odd">CxP <ul><li class="odd">Facturas de compra</li> <li class="even">Acumulado de obligaciones</li> <li class="odd">Ordenes de pago</li> <li class="even">Emisión de cheques y transferencias</li> <li class="odd">Comprobante de retención de IVA</li> <li class="even">Comprobante de retención de ISLR</li> <li class="odd">Notas de crédito de CxP</li> <li class="even">Notas de débito de CxP</li> </ul></li><li class="even">Compras <ul><li class="odd">Proveedores</li> <li class="even">Ordenes de compra</li> <li class="odd">Notas de recepción</li> <li class="even">Proveedores</li> <li class="odd">Ordenes de compra</li> <li class="even">Notas de recepción</li> </ul></li><li class="odd">Almacén y despacho <ul><li class="odd">Productos</li> <li class="even">Inventario</li> <li class="odd">Ajuste de entrada</li> <li class="even">Ajuste de salida</li> </ul></li><li class="even">Crédito <ul><li class="odd">Guía de transporte</li> <li class="even">Relaciones de cobranza</li> <li class="odd">Cheques</li> <li class="even">Notas de crédito de CxC</li> <li class="odd">Notas de débito de CxC</li> <li class="even">Facturas de venta</li> <li class="odd">Traslado de documentos de CxC</li> <li class="even">Devoluciones de venta</li> <li class="odd">Cierre de caja</li> </ul></li><li class="odd">Banco <ul><li class="even">Control de chequeras</li> <li class="odd">Conciliación bancaria</li> </ul></li><li class="even">Contabilidad <ul><li class="even">Plan de cuentas</li> <li class="odd">Comprobantes contables</li> <li class="even">Cierre de mes contable</li> </ul></li></ul></li></ul>

Saving tree status between page transitions[edit]

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

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

See the usage section, I've added an example id to the last example --Nad 20:00, 14 January 2009 (UTC)Reply

Don't include id= in transcluded sub-trees[edit]

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

Thanks I'll look in to that soon --Nad 19:59, 14 January 2009 (UTC)Reply

Not JS output[edit]

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:

 {{#tree:
 *Root1
 **Sub-item
 **Another sub-item
 *Root2
 **Sub-item
 **Another sub-item
 }}


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

P.S.:

zend.ze1_compatibility_mode Off Off

so not the same problem like # 4 Treeview suddenly stopped working in Navbar

P.S.S.: ok, the error occurs because i've installed this extension: Extension:Edit_Section_Link_Transform

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

dynamic drop-down menu[edit]

Hi, I integrated the dynamic drop-down menu into the sidebar on the left side, but now I added submenus and of course I can't see them because the sidebar is too small. I dont't like to expand the width of the sidebar, but I don't know how I could overlay the submenu without expanding the width from the sidebar. Is it possible? - --Ulli 757 22:11, 11 January 2009 (UTC)Reply

I find the menus go over the top of everything else on most skins including monobook (see example pic below) - what skin do you have? you'll need to fix the problem by modifying the menu's css rules. --Nad 19:55, 14 January 2009 (UTC)Reply

Thank you very much Nad - your image shows that my problem is solvable and it encourages me to continue the enhancements of my css-knowledges (I use monobook skin) - best regards --Ulli 757 22:24, 15 January 2009 (UTC)Reply
in the meantime I detected that it works with IE7, it doesn't work with firefox 3.... --Ulli 757 17:54, 16 January 2009 (UTC)Reply
Try starting with the CSS shown at Extension:TreeAndMenu#CSS styles for menus since thats known to work on both IE and FF, then adjust the design elements bit by bit so you revert any change that breaks it. Also we have a working example which works in both browsers at OrganicDesign:Extension talk:TreeAndMenu.php which also shows its CSS rules. --Nad 10:39, 18 January 2009 (UTC)Reply
I have the same result with the example from OrganicDesign, it's only a problem with ff 3 (it works in ff 3 if I use the exemple in a page). It seems to me z-index doesn't work as I expect using it on sidebar. I will google if there are some problems with z-index and ff3 - kind regards --Ulli 757 23:19, 20 January 2009 (UTC)Reply
How did you end up integrating the dynamic menu into the sidebar? --Gkullberg 13:42, 3 August 2009 (UTC)Reply
1. download the snapshot-version, 2. put the code into the ../extension/TreeAndMenu-folder, 3. add the "include"-line to LocalSettings.php, 4. add the hack ($wgHooks ...return true;} (see description on this extension front page) to LocalSettings.php after the "include"-line, 5. put alle the CSS-Code shown on the exetnsion page to the Mediawiki page "MediaWiki:Common.css", 6. write on the MediaWiki page "MediaWiki:NavTree" the following code: {{#menu: *Root1 **Sub-item}} (the stars beginning in col 1), 7. works in IE, not in FF 3 (I don't yet know the reason) Kappa 15:44, 5 August 2009 (UTC))Reply

Problems configuring the extension[edit]

Hello, i don't know if this is the right place to ask this but i don't know someone else to ask too, I've followed the instructions from here Extension:Treeview but it still does not work for me, the tree appears like a nested list and this line {{#tree appears just like a static text (i did changed my MediaWiki:Common.css article. Can you help me to configure this? I really need this to work because it is very helpfully to me,

Thank you very much

If you're seeing the #tree symbol then it sounds like the extension's not installed, go to your Special:Version page and see if TreeAndMenu is in the list of installed extensions. Also, it would help to know what version of MediaWiki you're running. --nad 08:27, 21 January 2009 (NZDT)

in Special:Version is only this:

Product  	Version
MediaWiki 	1.13.3
PHP 	5.2.6 (apache2handler)
MySQL 	5.0.51b-community-nt-log

but in my LocalSettings.php file i have include("$IP/extensions/TreeAndMenu/TreeAndMenu.php"); (i also tried with include("extensions/TreeAndMenu/TreeAndMenu.php"); ) and no result. I've tried also with MediaWiki version 1.12.0

Thanks for helping me

Specifically you need to see if the TreeAndMenu extension show up in that Special:Version page, if its not showing up in there then you haven't done the correct include statement in your LocalSettings.php file. --nad 12:25, 21 January 2009 (NZDT)



Now i can see the TreeAndMenu in the Special:Version but i can't use the tree; i can use the menu but if i edit the main page and enter the lines {{#tree: *Root1 **Sub-item **Another sub-item *Root2 **Sub-item **Another sub-item }} nothing appears (i did edit the articl http://localhost/wiki/index.php/MediaWiki:Common.css), not even a nested list; what can i do?

Thanks

what did you "edit" in the MediaWiki:Common.css (Finally, add the CSS stylesheet to your installation by modifying/creating your MediaWiki:Common.css article (note that's an article not a file). Otherwise, your menu will look just like a nested list.) also check out this article on cache issues... --phalseid 04:00, 22 January 2009 (NZDT)
Try looking at the html source of your page with the tree and see what it's outputting, probably the image paths are incorrect making it zero-size or somehting. --Nad 20:25, 21 January 2009 (UTC)Reply

Tree is not displayed[edit]

The tree is not displayed, only the menu; The errors from the Firefox console are:


1)Error: dTree is not defined -in the html code i have something like this <script type="text/javascript" src="/wiki\extensions\TreeAndMenu/dtree.js"> and i think there is something wrong with the path; what should i do to automatically get the right path (/wiki/extensions/TreeAndMenu/dtree.js) - there is a \ instead /


2)Warning: Error in parsing value for property 'display'. Declaration dropped. Source File: http://localhost/wiki/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 Line: 179 -here there is a problem with the line display from the block: body div.NavShow {

       display: normal;

}

What should i do

Thanks

Are you still working on "localhost"? -> quick and dirty solution: try to replace the line $this->baseUrl = preg_replace('|^.+(?=[/\\\\]extensions)|', $wgScriptPath, $this->baseDir); on line ~65 in TreeAndMenu.php through $this->baseUrl = '/yourwikiname/extensions/TreeAndMenu/'; (please don't use this in a production system!!)- --Ulli 757 18:31, 21 January 2009 (UTC)Reply


This is working partially, the links appears but no images is loaded (the computer, folder... icons) and the links from the root are not 'tabbed', their positions it is just bellow the root

I've installed again so now i have http://192.168.0.2/wiki but i still have this line in the html code <script type="text/javascript" src="/wiki\extensions\TreeAndMenu/dtree.js"> and it does not load the js file...


I also have in the htlm code this line for (i in tree.icon) tree.icon[i] = '/wiki\extensions\TreeAndMenu/'+tree.icon[i]; I've replaced in the TreeAndMenu.php line 65 with $this->baseUrl = '/wiki/extensions/TreeAndMenu/'; but in the html code only the line <script type="text/javascript" src="/wiki\extensions\TreeAndMenu/dtree.js"> changed but the line with tree.icon[i] still has the wrong path

you could set $wgTreeViewImages = "http://localhost/yourwiki/extensions/TreeAndMenu/img"; in LocalSettings.php (just for tests with localhost). Could you please sign your contributions? (with --~~~~ ) on the end? It would be easier to follow the discussion - thanks - --Ulli 757 19:07, 22 January 2009 (UTC)Reply
You're having trouble due to the backslashes that windows file paths have, thats why the preg_replace line above is used (which you removed). Javascript doesn't like backslashes in strings. --Nad 19:37, 22 January 2009 (UTC)Reply
I just used them temporary (in my windows system :-( , in my production system (linux) I use your original code and this works fine :-) - kind regards --Ulli 757 20:20, 22 January 2009 (UTC)Reply

dTree.js path incorrect[edit]

Hello,

Tried to get TreeAndMenu in today but found a potential problem with it. The extension tries to include it's javascript and it uses a full path to do so which is incorrect for my server e.g.

<script type="text/javascript" src="/home/blah/web/htdocs/mediawiki/extensions/TreeAndMenu/dtree.js">

it should be just

<script type="text/javascript" src="/mediawiki/extensions/TreeAndMenu/dtree.js">

The error I believe is on line 64 of TreeAndMenu.php

$this->baseDir  = dirname(__FILE__);

Version r44288 of the code grabbed from svn. Regards, Chris --78.105.2.27 19:12, 28 January 2009 (UTC)Reply

Okay it's not that line, I changed the order of line 65 & 66 so it does the str_replace first, noww the path is correct. Linux box btw so no problem with \'s --78.105.2.27 19:19, 28 January 2009 (UTC)Reply

I can double that, had to change those two lines to see the treeview and the icons. so now it looks like:
/* Update general tree paths and properties*/
$this->baseDir  = dirname(__FILE__);
$this->baseUrl  = str_replace('\\', '/', $this->baseDir);
$this->baseUrl  = preg_replace('|^.+(?=[/\\\\]extensions)|', $wgScriptPath, $this->baseDir);
We had to change a line below to make it work on Windows machine (Jul 15, 2010):
$this->baseUrl  = preg_replace('|^.+(?=/ext)|', $wgScriptPath, $this->baseUrl);

Custom root icon for a single tree[edit]

I'd like to use different root icons for trees on my site.

Is it possible to select a special root icon for a single tree?

It would be great to have an option for that like:

{{#tree: root=myroot|rootimage=path to file|... }}

Or even better, one can select a full image set for a single tree:

{{#tree: root=myroot|imagedir=subdirname|... }}

Thanks for replay --Dst 15:54, 2 February 2009 (UTC)Reply

Collapsing trees[edit]

Is there a way to collapse a tree to rootname only?

I'd like to display additional information, especially for short descriptions of input fields, on opening the first tree level.

Thanks --Dst 16:35, 2 February 2009 (UTC)Reply


Dynamic openlevels[edit]

Hi, if I have the Tree on the sidebar then is it possible to open the level of tree based on the current page opened. So that the users can easily locate their location in the tree.

For example. If I have some thing like this:

 {{#tree:id=siteTree|openlevel=2|open=top|close=bottom|root=Organic Design|
 *Root1
 **Sub-item
 *** sub-sub item
 *** sub-sub item2
 **** sub-sub item3
 **** sub-sub item4
 **Another sub-item
 *** sub-Another sub item
 *** sub-Another sub item2
 **** sub-Another sub item3
 **** sub- Another sub item4
 }}

and I am on page “sub-sub item3” then the tree on the sidebar should expand up to the level of “sub-sub item3” and the rest (from “Another sub-item” onwards) still remains contracted.

Thanks,

ssaq22 14:55, 9 February 2009

Misformatted URL - Menu View[edit]

.../\"/index.php?title=Special:RecentChanges\"

how can i solve this problem? i didn´t find the section within TreeandMenu.php which is responsible for the output


Problem is already solved
before this line $nodes .= "<li class=\"$class\">$item";
Insert
$item = str_replace("\\","",$item);

Yup, noobie time again[edit]

HI after many days of searching, I think this is deff the right menu for me..I installed it works like a dream... but I would like to add the Menu to my sidebar, I would prefer the Menu, and not the Tree. Could someone point me in the right direction to get this implemented. Thanks in advance, --Satire3rd 18:31, 19 February 2009 (UTC)Reply

Nevermind, I figured it out, now I'm having the same problem Ulli 757...The menu doesnt want to show up on Firefox, or Chrome, IE works fine though. --Satire3rd 18:45, 19 February 2009 (UTC)Reply

dTree undefined[edit]

Hey, I know, that this problem has been handled many times before^^ But i can't figure out, why the trees don't display on my machine...

OS: Win Server 2003 MW: 1.14.0 PHP: 5.2.8(apache2handler) Tested Browser: IE7 and Firefox (latest Version) Does someone would like to post the steps, how to solve this problem? menu works fine(thanks to all little helpers;)) but tree-space is empty. IE and FF error message: dTree is undefined. they should show up at the main page; not in the sidebar. Tried the solutions from above but they don't work for me...

Thanks in advance!


--freezone 15:39, 30 March 2009 (UTC)Reply

Notice: Undefined offset: ... line 209[edit]

I'm getting an error printed when using the #menu mode. The menu displays fine but the error prints at the top of every page that displays a menu.

Notice: Undefined offset: 8 in /var/www/html/extensions/TreeAndMenu/TreeAndMenu.php on line 209

I first tried the 1.14 snapshot then the Development snapshot to no avail. In addition, #tree mode doesn't display anything at all for some reason.

UPDATE
This issue is only occuring when using DPS for dynamic menu's
Code that causes issue:
{{#menu:
*[[:Category:Production|Production Packages]]
{{#dpl:debug=0|category=Production|format=,**,[[%PAGE%]]\n,}}
*[[:Category:Release Candidate|Release Candidate Packages]]
{{#dpl:debug=0|category=Release Candidate|format=,**,[[%PAGE%]]\n,}}
}}

If no one else has seen this problem then just ignore / delete this post.--Zinthose 22:39, 6 April 2009 (UTC)Reply

I've got the same issue (MediaWiki 1.15.3, TreeAndMenu 1.1.1, DynamicPageList 1.8.9) : my NavTree based on DPL and TreeAndMenu extensions doesn't work anymore (see Creating Category Trees with DPL extension). I'm getting the same error (Notice: Undefined offset: 1 in [...]\extensions\TreeAndMenu\TreeAndMenu.php on line 201). Can someone help ? --Megajoule 20:49, 7 June 2010 (UTC)Reply

Page Size Bloated with TreeAndMenu[edit]

TreeAndMenu seems to load each image used in the tree (folder, page, root icons, etc.) from the webserver, each time they are used. I'm not sure if this is just how web pages work, or if the browser thinks each image is unique and needs to be loaded again. In any case, after I added my tree to the sidebar, each page in my wiki was now >1MB in size (1100 images are reported as being loaded to support the tree). All of the collapsed nodes, and their content, are included in that image count.

After suffering poor performance for a while, I installed the simplistic Firefox Extended Statusbar. It simply reports (in Firefox) the time it takes to load a page, the size of the page, and how many images were loaded. To my surprise, all of my MediaWiki articles were loading 1100 images! Also, each article was greater-than 1MB!

Sure enough, loading the official Treeview extension page results in an 863KB page with 825 images.

Is there any way we can get our browsers to only load each unique image, once?

I love this extension, so until this is fixed, I will artificially reduce the size/depth of the tree. Thanks! -Cedarrapidsboy 16:14, 20 April 2009 (UTC)Reply

That status bar is counting all images even when they're loaded from local cache because if you do a full refresh you see the real time it takes to load everything. The large load size shown includes 100's of KB of CSS and JS as well as images, but those items are only transferred rarely. --Nad 01:28, 21 April 2009 (UTC)Reply
Thanks. I'll have to use a more reliable network monitor to see what is actually passing over the wire. One good thing that came out of this experiment, we removed a bunch of information from our trees that likely was only clutter.  :) The bad news... not a silver bullet for our performance issues. --205.175.225.24 12:27, 21 April 2009 (UTC)Reply

Installation[edit]

Why not extending the Installation-Chapter with another version "Installation for dummies" (e.g.: me)

I would really appreciate to use the tree but the installation process described is surely not covering 100% of the steps necessary.

  • no information on what to do with dtree.js
  • no information about path to images and where to set this (if neccessary?)

May be some other requests on this page are produced by this lack of information, too? Finally I did not figure it out. Please someone with a standard virgin mediawiki setup describe a complete list of steps which are to be done to get tree view with symbols as well as within the sidebar. Thank you.

Images section not helpful[edit]

The Images section on the main page is not particularly helpful. I was looking for a discussion on how images work and how you can control them, but the Images section contains nothing other than a bulleted list of something - maybe image names? Unjedai 23:00, 9 June 2009 (UTC)Reply

Last version wrong[edit]

The main page lists the Last Version as "1.0.8 (2008-12-08)" but it appears that as of today, 9 June 2009, the Last Version is 1.14. Unjedai 23:00, 9 June 2009 (UTC)Reply

Updated to 1.1.0 as current. Shinjiman 17:59, 26 June 2009 (UTC)Reply

Self Node Title Disappearing on load[edit]

I have this installed and working very nicely. However there is one problem that I cannot seem to figure out. When you click on a node link and load up the page, that node is then omitted from the tree when the reulsting page loads. I checked and the node is actually missing from the page source for the construction of the tree. I am using DPL to dynamically add the subnodes based on a category membership. Any thoughts on why this might be happening? --Bsmithme 01:11, 21 June 2009 (UTC)Reply

I just figured out why this was happening and it wasn't due to TreeAndMenu. Since I'm using DPL to create the nodes in the tree, DPL defaults to NOT including the current page in the list. Setting skipthispage=no in DPL solves this. --Bsmithme 03:21, 21 June 2009 (UTC)Reply

Icon look and feel[edit]

As currently the icon set are still using the XP theme, is that have a chance to use a newer set of icons by default like Vista 7 theme? And I think there's would be possible to make the mouse hover effect for the +/- icons. :) Shinjiman 17:14, 23 June 2009 (UTC)Reply

Just updated on rev:52871, any feedbacks are welcome. Shinjiman 17:59, 26 June 2009 (UTC)Reply

Add Menu to Sidebar?[edit]

Adding a tree to the sidebar seems pretty easy. However, is it possible to add a menu to the sidebar? Are there any examples out there? --Gkullberg 18:01, 27 July 2009 (UTC)Reply

I figured out how to do this. I followed these instructions: Manual:Interface/Sidebar#MediaWiki 1.13.2 so that the sidebar allows wiki markup. Then I could edit MediaWiki:Sidebar and add the tree. --Gkullberg 13:28, 6 August 2009 (UTC)Reply
In my MediaWiki 1.15.0 this solution works fine with IE, but it does not work with Firefox 3.0.13. If I change in ../skins/monobook/main.css ".portlet {overfolw:hidden;}" to ".portlet:overflow:visible;" the Firefox version can be used if further sizes are rearranged and overflow is "controlled" by blanks and line breaks. But in this case the IE version is full of overflows --Kappa 15:45, 6 August 2009 (UTC)Reply
Has anyone tried implementing this with the new Vector skin that is part of the Usability Initiative? --Gkullberg 18:40, 7 September 2010 (UTC)Reply

no-script-version[edit]

Hi,

I'd like to rebuilt the sidebar as a treeview including everything that is not pagecontent in narrower sense – like Special:MyPage, Special:UserLogout, Categories, etc. But when a user has javascript disabled, the sidebar will be empty at all. Is it possible to add a no-script-version in the way, that the tree is displayed with all folders opened and without "+"/"-"?

Sorry for my lack of English, hope you understand my problem. Greetings --WiMu 10:12, 9 August 2009 (UTC)Reply

StubObject problem[edit]

Hi, I'm running:

Windows XP SP3

XAMPP 1.7.2

PHP 5.3.0


I've installed DPL and have been trying to get TreeAndMenu to work for about a week. I keep getting this error: Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in E:\xampp\htdocs\mediawiki\includes\StubObject.php on line 58

I can suppress it by turning error reporting off but it seems that there is something else wrong with TreeAndMenu. The #menu function works, the #tree function doesn't, at all. Furthermore, #dpl syntax doesn't work inside of #menu

The path to dtree.js is a windows path, which was supposed to be fixed in the last revision to TreeAndMenu.php. I am confused. By hardcoding it I have gotten #tree to output something, but it still doesn't work with #dpl syntax (the #dpl syntax just appears like any other text, rather than activating).

Any suggestions are appreciated. I'm at my wits' end and can find no collapsible list extensions for mediawiki that don't throw that warning at me.


Hi, I have exactly the same issue, the same message.
My config is :
  • MediaWiki 1.15.1
  • PHP 5.3.0 (apache2handler)
  • MySQL 5.1.37-community-log
Thanks in advance for your help (your extension is just what I was looking for). B2T2009-09-10


it's B2T again . I solved the error display by puting the include at the top of the php file just after the php tag.
nevertheless and despite the fact that I tuned my Common.css page, I still don't have any tree :(
hhhhheeeelllppp !

Hi, I had the same issue. Besides the fix that B2T suggested of moving the include to the top of the php file, you can do this (Jul 15, 2010):

Find this line in Language.php in the languages folder and change this line:

Original - function getMagic( &$mw ) {

Fixed - function getMagic( $mw ) {

Menu with Submenus shows an Arrow[edit]

Is there any way to have the main menus with submenus display an arrow for users to know that there is a submenu?

Thanks

MouseOut Timeout?[edit]

Lostpedia has a menu installed on their left nav bar. The nice thing about it is that when you take your mouse off the nav bar there is about a 1/2 second delay before the menu goes away. It seems like there's a small bit of JavaScript controls this. Is there any way to provide the same sort of functionality for TreeAndMenu? --Gkullberg 12:00, 29 October 2009 (UTC)Reply

Conflicts with php 5.3?[edit]

hi folks,

are there any known bugs for this ext. running on a webserver with php-versions > 5.3?

I updated my configuration from php 5.28 to 5.3 (centos 5.3, apache 2.2.3) because another app on the webserver need the new php version. After that the extension stopped working and so i tested it in a new environment based on xampp1.7/winxp and it's working as intended.

Thanks in advance

i just updated to php 5.3.6 and from what i can tell this extension is incompatible. despite #tree and #menu both being explicitly defined in parser function hooks on Special:Version, #tree still does not work. [#menu works properly] i am running mediawiki 1.15 and have tried treeandmenu versions 1.0.9 and 1.1.1. Zeefreak 21:01, 14 June 2011 (UTC)Reply
oddly, i ended up fixing this when i tried to solve another issue i was having. after enabling php debug, i was seeing the following:
Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in /path/to/wiki/includes/StubObject.php on line 58
the fix for that is to edit $WIKI/languages/Language.php by changing the following:
- function getMagic( &$mw ) {
+ function getMagic( $mw ) {
that fixed both the StubObject.php error and TreeAndMenu #tree not working. Zeefreak 21:17, 14 June 2011 (UTC)Reply

Works with other extensions/templates?[edit]

I'm trying to use the TreeAndMenu extension to dynamically display RSS feeds on my wiki. To that end I have installed the SimpleFeed extension as well. I am trying to get them to play nice with eachother so that I can see the feeds' headlines in a tree.

I have the following code on my page:

Code:

{{#tree:
*Test
*{{#tag:feed|{TITLE}|url=http://rss.slashdot.org/Slashdot/slashdot|entries=1}}
}}

Which results in the following output, where "Test" is part of the tree, but the rest is directly after it.

Test

?2tam4b68f35c6dbd2

What is going on here? Am I doing something that can't be done? When I have just the Code:

{{#tag:feed|{TITLE}|url=http://rss.slashdot.org/Slashdot/slashdot|entries=1}}

line I can see the headline of the first news item.

Thanks, RotsiserMho 04:04, 3 February 2010 (UTC)Reply

Different view for printable...[edit]

I am hoping this has already been done and maybe a simple implementation. Basically I would like when my users goto the printable version of a page they just get a simple UL/OL of what is in the tree instead of the javascript version. Any thoughts?

So diving a little further I guess I need some condition to use to tell this extension to not render the tree if we are in print mode. $wgAction is view for both print and regular viewing, what else could I use?

Fix Problems with Alignment[edit]

I was having problems with items below the menu butting up against it unpredictably, and as the menu changed size.

I just added <display: inline-block;> to .dmenu{} in the css file(common.css for me)

Tree rendering failure and menu link URL mismatch[edit]

Hi, I installed TreeAndMenu for my MediaWiki 1.12 and after reading all the advices on this page I still can't get neither the tree nor the menu working.

1. The tree below doesn't appear at all:

{{#tree:
* [[Mainpage]]
** [[Subpage1]]
** [[Subpage2]]
** [[Subpage3]]
** [[Subpage4]]
* [[NewPage]]
}}

Only the items on the first tree level are rendered to simple links. They appear like

Mainpage

NewPage


2. The menu is in fact rendered but the generated link URLs are faulty. The following example generates the URL http://ourwikidomain/mediawiki/index.php/mytopic/\"/mediawiki/index.php/Mainpage\" instead of http://ourwikidomain/mediawiki/index.php/Mainpage when the menu below is inserted in the page http://ourwikidomain/mediawiki/index.php/mytopic:

{{#menu:
* [[Mainpage]]
** [[Subpage1]]
}}

During the preview when editing the file I also get another URL, when I hover the mouse over the link text: http://ourwikidomain/mediawiki/index.php/\"/mediawiki/index.php/Mainpage\"

I put here some of my settings and hope somebody will be able to diagnose the failure:

LocalSettings.php
   		$wgScriptPath       = "/mediawiki";
TreeAndMenu.php
   		$this->baseUrl  = str_replace('\\', '/', $this->baseDir);
		$this->baseUrl  = preg_replace('|^.+(?=[/\\\\]extensions)|', $wgScriptPath, $this->baseDir);
# Fix EW:
		$this->baseUrl = '/mediawiki/extensions/TreeAndMenu/';

I'm not experienced in PHP. Could somebody tell me the right settings?

Ewitsolutions 13:22, 29 April 2010 (UTC)Reply

Menu is displayed but Tree is not displayed[edit]

I used the TreeandMenu.php to display the tree view. However the treeview was not displayed correctly. I tested with some sample code from Mediawiki. Here is the code.

{{#tree:
*Root1
**Sub-item
**Another sub-item
*Root2
**Sub-item
**Another sub-item
}}

{{#menu:
*Root1
**Sub-item
**Another sub-item
*Root2
**Sub-item
**Another sub-item
}}

{{#tree:id=siteTree|openlevels=1|root=Organic Design|
*Root
**Sub-item
**Another sub-item
}}

It displayed a menu but instead of the tree, I got the display as text with bullets. Is there anything I am missing?

Following is the HTML source ouput on firefox.

{{#tree:
</p>
<ul><li>Root1
<ul><li>Sub-item
</li><li>Another sub-item
</li></ul>

</li><li>Root2
<ul><li>Sub-item
</li><li>Another sub-item
</li></ul>
</li></ul>
<p>}}
</p><p>
<ul class='dmenu' id='4c2b8f5de041a'>
<li class="even">Root1
<ul><li class="even">Sub-item</li>
<li class="odd">Another sub-item</li>
</ul></li><li class="odd">Root2
<ul><li class="even">Sub-item</li>
<li class="odd">Another sub-item</li>
</ul></li></ul>
<script type="text/javascript">/*<![CDATA[*/
if (window.attachEvent) {
var sfEls = document.getElementById('4c2b8f5de041a').getElementsByTagName('li');
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() { this.className+=' sfhover'; }
sfEls[i].onmouseout=function()  { this.className=this.className.replace(new RegExp(' sfhover *'),''); }
}
}
/*]]>*/</script>
							
</p><p>{{#tree:id=siteTree|openlevels=1|root=Organic Design|
</p>
<ul><li>Root
<ul><li>Sub-item
</li><li>Another sub-item
</li></ul>
</li></ul>
<p>}}
</p>


I have the exact same problem as described here (above). I'm running:

  • TreeAndMenu: Version 1.0.9, 2009-02-15
  • MediaWiki: 1.15.1
  • PHP 5.3.2-1ubuntu4.5 (apache2handler)
  • Host-OS: Ubuntu 10.04
  • Kernel: 2.6.32-22-generic

I've followed the installation instructions and the #menu is parsed and rendered correctly. However #tree is not even detected as a parser function. dTree.js is successfully loaded. If I look at the generated HTML for my page I get the same result av shown above. TreeAndMeny shows up in special pages with correct version. Apache have (at least) read access to all necessary files.

henrik.thuren 14:06, 29 December 2010 (CET)

Same problem here, PHP 5.3.5, Mediawiki 1.17, no other extension enabled

--61.114.185.196 01:11, 15 July 2011 (UTC)Reply

Exhausting Memory[edit]

When I view my main page while logged out, I get the following error:

<sample>Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 425327 bytes) in /glide/apache/www/wikiuat/extensions/TreeAndMenu/TreeAndMenu.php on line 267</sample>

If I log in and go to the main page, there is no problem. Any reason why logging in/out would affect the behavior? Guy.yedwab 14:27, 1 July 2010 (UTC)Reply

Links not rendering correctly[edit]

Something is really bogus about my installation, because if I try to make a link out of a menu item, it does not render correctly. Here is some more information:

{{#menu:id=mainMenu|
* [[Customer_Main_Page|Customers]]
* [[Developers_Main_Page|Developers]]
* [[Consumers_Main_Page|Consumers]]
* Divisions
** [[Southern Division DIVR|South]]
** [[North Central Division DIVR|North Central]]
* Links
** [http://workgroups.<our domain>.com/workgroups/customerservice/intranet/CM/Wiki/Home.aspx Legacy Wiki]
** [[On_Call_Main_Page|On Call]]
** [[Ops Main Page|Operations]]
** [[Special:PopularPages|Popular Pages]]
** [[TerminologyGlossary|Terminology Glossary]]
** [[Development_Teams|Development Teams]]
}}

When I look in firebug at the link that was generated for Customers, it looks like this:

<a page\="" main="" title="\"Customer" href="\"/wiki/index.php/Customer_Main_Page\"">Customers</a>

All the links are broken in similar fashion. I can't actually use the menu to link to anywhere. I'm using MediaWiki 1.15.4.

One thing that may be relevant is this:

Every other page load (yeah, weird, eh?) I get the following error (I'm using the latest build from subversion, 1.1.1):

Errors:
    * Notice : Undefined offset: 13 in /var/www/html/wiki-1.15.4/extensions/TreeAndMenu/TreeAndMenu.php (line 214)
      trace:
         1. [internal function]: TreeAndMenu->renderTreeAndMenu( Object(Parser), '<p>?1tam4c62e34a082df?mainMenu?0? <a href="/wiki/i...' )
         2. ./includes/Hooks.php (line 117): call_user_func_array( array(), array() )
         3. ./includes/parser/Parser.php (line 411): wfRunHooks( 'ParserAfterTidy', array() )
         4. ./includes/Article.php (line 3557): Parser->parse( '{{#menu:id=mainMenu|* [[Customer_Main_Page|Custom...', Object(Title), Object(ParserOptions), bool(true), bool(true), 27817 )
         5. ./includes/Article.php (line 979): Article->outputWikiText( '{{#menu:id=mainMenu|* [[Customer_Main_Page|Custom...' )
         6. ./includes/Wiki.php (line 450): Article->view()
         7. ./includes/Wiki.php (line 63): MediaWiki->performAction( Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest) )
         8. ./index.php (line 116): MediaWiki->initialize( Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest) )

Any thoughts?

TreeAndMenu at Sidebar with Skin Vector?[edit]

I installed mediawiki 1.16 with the skin vector and extension TreeAndMenu. On a normal page TreeAndMenu shows up fine, but I did not make it work on left sidebar. I have now add the following code to LocalSettings.php (under the include):

$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></div>'.$out->getText();
        return true;
        }

This code looks like made for monobook, but I have vector. Any thoughts how to change this code to fit to vector skin? Thanks in Advance.

>>Try with: $wgHooks['SkinTemplateToolboxEnd'][] = 'wfNavTree';

I Tried this

 $wgHooks['SkinTemplateToolboxEnd'][] = '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></div>'.$out->getText();
        return true;
        }

with 1.17 vector and does not work - :(

AddSlashes Breaking URLs[edit]

Well i'm only using this for menus. However I found its breaking screwing up URLS Using this for a menu I was simply doing *[[:Category:SomeCategory|SomeCategory]]

if ( $item ) $rows[] = array( $rootId, $depth + $depths[$id], $icon, addslashes( $item ), $start );

The addslashes is screwing up URLS, removing it fixes the problem. Kilandor 03:03, 19 October 2010 (UTC)Reply

Openlevels is acting weird[edit]

Major:

When starting a tree with :

{{#tree:id=456|openlevels=1|root=Project Knowledge|
* Item 1 
* Item 2
}}

...and then looking at my page, the Trees are open on first refresh and closed with the next one. Each "refresh" toggles their state with no click-action whatsoever involved. Problem is identical on IE8 and FF.

Minor: Also my current version of Tree and Menu 1.1.1 is not showing any fine line grafics between my folders.

1.16.2 Vector Skin[edit]

Has anyone found a solution of how to work the menu and the tree in the sidebar for Vector Skin in 1.16.x? I know several people have asked the question. The Menu Extension sort of works but its not all that neat or tidy. Any help is much appreciated thanks. Nali.

>>Try with: $wgHooks['SkinTemplateToolboxEnd'][] = 'wfNavTree';

Exclude Files from TreeMenu[edit]

Hi,

does anyone know if it is to exclude all files from a tree menu. My tree menu shows all pages from certain categories but also the files that are inside of these categories.

Thanks in advance.

Got that! Just set the namespace properly. I choose main (excluding file).

Tree in Sidebar collapses, after select a link[edit]

I use TreeAndMenu together with Extension:CustomNavBlocks
I have defined my tree inside a CustomNavigationBlock like:

{{#tree:id=siteTree|openlevels=1|root=Organic Design|
*[[Root]]
**[[Sub-item]]
**[[Another sub-item]]
}}

Now, if I select a Link, the tree collapses to his starting state.
After I do a reload, he expanded back to his last persisted state.
Is the a workaround that he shows allways his persited state?
Grettings
Heiko

Dud links in menus[edit]

Hi.

Great extension! Having an issue with links in menus though. I have the following:

{{#menu:
*Local Information
**[[Announcements]]
**[[News]]
**[[Classifieds | Classifieds]]
**[[Help | Help and Advice]]
}}

The links are having \"/ /" wrapped round them. For example News becomes www.localhost/wiki/index.php/\"/iow/index.php/News\" (with the quotes) so of course the page is not found. Also when you hover over items you see "\News\" (again with the quotes and backslashes).

I'm using the MW 1.16 snapshot on MW 1.16.1 running on Ubuntu 10.10.

Any ideas what is wrong? Thanks --Mitchelln 10:51, 18 March 2011 (UTC)Reply

Hmm, so this is definitely a problem with addslashes (found further up)
if ( $item ) $rows[] = array( $rootId, $depth + $depths[$id], $icon, addslashes( $item ), $start );
changed to:
if ( $item ) $rows[] = array( $rootId, $depth + $depths[$id], $icon, $item , $start );
and URLs are then okay, but hover text no longer shows.
--Mitchelln 12:07, 18 March 2011 (UTC)Reply

Menu auto-collapse[edit]

Is there a way to make sure the tree always auto-collapses back to openlevels=0 when the page is accessed multiple times during the same session? I'm not using an ID currently. I'm running this on a Kiosk with the tree as the main method of in-page navigation. It links to other pages, and the user returns after visiting the other pages. I need the tree to collapse on those subsequent visits. I'm using the close=top parameter to give the users a quick way to collapse the tree, but it would be nice if it did it automatically. Thanks!

WilliamCooper 15:43, 10 June 2011 (UTC)Reply

Broken in 1.17.0[edit]

This extension breaks in MediaWiki 1.17.0, if you use the 1.17.x snapshot version from mediawiki.org, throwing this JavaScript error:

dTree is not defined

This is in Firefox 3.6.18.

I also tried the most recent version (tip of the subversion repository) and the error is the same. --Maiden taiwan 19:53, 7 July 2011 (UTC)Reply

I think the problem is that dtree.js is being included at the bottom of the page, but new dTree() is called above it. See the ResourceLoader docs. Maiden taiwan 20:00, 7 July 2011 (UTC)Reply
Should be fixed in the latest version, TreeAndMenu 1.2.2 --118.90.115.121 05:07, 8 July 2011 (UTC)Reply
Yep, it's fixed! Thank you. Maiden taiwan 13:39, 8 July 2011 (UTC)Reply

Don't use Parser::parse()[edit]

I am contributer to Extension:VariablesExtension and other similar extensions. Users were complaining that those extensions won't work properly with some extensions, on of them your extension TreeAndMenu. Due to my investigation this is because of sloppy use of Parser::parse() which is triggering the hook ParserClearState too early. This is resulting into deleting all the variables of VariablesExtension afterwards. Due to the Parser class documentation Parser::parse() shouldn't be called recursively. Since this function is called for parsing a wiki page, your extension shouldn't use it. Instead use Parser::recursiveTagParse() which will do the same job without any side effects. Hope you can fix this for users of both extensions in your next revision. --Danwe 00:31, 24 July 2011 (UTC)Reply

Hi, here is the report related to TreeAndMenu/Variables extensions interaction. Many thanks in advance :) --Mindrones 12:46, 24 July 2011 (UTC)Reply

New version is not to be compatible with MediaWiki 1.17.0[edit]

Version 1.2.4 is not to be compatible with MediaWiki 1.17.0.The error massage is "dtree-object not defined"

Version 1.3.0 has fixed this problem by hooking the tree building code into jQuery's ready event. The error was occurring in all versions of MediaWiki from 1.16 onwards, but is working now in 1.16.5, 1.17.1 and 1.18.0 (1.19alpha not tested yet) --Nad 02:16, 9 January 2012 (UTC)Reply
Scratch that, it's not working in 1.17+ still, I'll try and get it fixed soon --Nad 02:51, 9 January 2012 (UTC)Reply
How do we get download Version 1.3.0? Where is it please ? --81.103.57.161 08:55, 14 January 2012 (UTC)Reply
Sorry, I reverted back to 1.2.4 as 1.3.0 had created more bugs, but from my own testing on 1.17 it seems to be working ok. I'll take another look later when I know more about how to use the new ResourceLoader that comes with 1.17+ which needs to be used for JavaScript now. --Nad 13:12, 14 January 2012 (UTC)Reply

Needs (optional) Bracketing Lines[edit]

Large tree structures are hard to interpret, especially when there are many levels and many leaves. Could we add an option for bracketing, similar to [1]?

#ifgroup[edit]

One of your examples uses the function #ifgroup. i tried using it and it would appear my installation does not include this function. i was wondering what i need to add to be able to make use of this functionality? i am using mediawiki 1.16.5 --Kay 12:09, 21 October 2011 (UTC)Reply

Check UserFunctions Extension

That's in Extension:SimpleSecurity --Nad 02:13, 9 January 2012 (UTC)Reply

Vertical tree?[edit]

I am looking for a vertical drop down menu, like http://deadisland.wikia.com/ has. Is this possible with this extension, if not is there other extensions that do this? Igottheconch 18:50, 9 November 2011 (UTC)Reply

Snapshot download version is not 1.2.4[edit]

I just used the "download a snapshot" for the latest version of this extension, and I got 1.2.2, not 1.2.4 as shown in the info box. Maiden taiwan 22:13, 13 January 2012 (UTC)Reply

The snapshots are taken at the time the MediaWiki version you selected was released, if you want the most recent version select "trunk". --Nad 22:30, 13 January 2012 (UTC)Reply

Another Tree not showing 1.18[edit]

It has been stated that TreeandMenu works for clean installs of 1.18, but not for me. I have added the include and have common css loaded. The menus work fine. The tree code appears unchanged on the rendered page. Reviewing multiple previous posts, I would make the guess that it relates to path problems on the windows server, however I haven't been able to figure it out. Any help would be appreciated. I haven't been able to get error logging enabled unfortunately.

--96.248.16.97 21:21, 27 January 2012 (UTC) Windows Server - MediaWiki 1.18.0 - PHP 5.3.8 (cgi-fcgi) - MySQL 5.5.19 - TreeAndMenu (Version 1.3.0)Reply

Wonderful, version 2.0.0 corrects my problem, Thanks NAD --96.248.16.97 22:02, 30 January 2012 (UTC)Reply
Secondary issue: Using Navtree modification for sidebar, previous regular links appear correctly, however a tree doesn't appear there (Vector Skin). I have added to LocalSettings.php:
$wgHooks['SkinTemplateToolboxEnd'][] = '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></div>'.$out->getText();
        return true;
        }

--96.248.16.97 22:02, 30 January 2012 (UTC)Reply

Version 2.0.0 developed for MW1.18+[edit]

I've made a new version, 2.0.0 which is designed to work more in accord with the way that MW1.18+ handle JavaScript. --Nad 00:37, 29 January 2012 (UTC)Reply


I've downloaded the trunk version (2.0.0) today and tested in Chrome, Firefox and IE7 (the most problematic) with MediaWiki 1.18.1
Trees and Menus works fine inside pages with all browswers, but only when we are logged out (In my wiki, logged out users can't edit. Only auto confirmed users.)
When I make the log in as sysop, however, the tree disapears and in its place there is only scrambled numbers and symbols, something like this:
1tam4f2845a139e31?siteTree?0?Root?2tam4f2845a139e31 ?1tam4f2845a139e31?siteTree?1?Sub-item?2tam4f2845a139e31 ?1tam4f2845a139e31?siteTree?1?Another sub-item?2tam4f2845a139e31
I tested the sidebar too. I placed the code for vector skin in localsettings and when I place a common text in MediaWiki:NavTree it imediately appears below tollbox. However, when I add a Tree in MediaWiki:NavTree, nothing is show below the toolbox.
The logged in/out behaviour in the case of Sidebar is:
  • when logged out, nothing shows up at the sidebar.
  • when logged in, scrambled numbers appears below the toolbox.
--Luis Orlando 20:02, 31 January 2012 (UTC)Reply

Removing navigation from sidebar in vector[edit]

I would like to remove the current navigation in the sidebar and replace it with my own treeiew. Is there a simple way to do this that I am missing?

  • I have placed {{#menu: *Root1 *Root2 }} in MediaWiki:NavTree
  • and removed all text from MediaWiki:Sidebar.
but I still have the old navigation in the sidebar

--Catamarandreams 16:28, 4 February 2012 (UTC)Reply

/* Vector - Hide Native Sidebar Elements */
#p-navigation, #p-tb h5, #p-tb div.body { display:none !important; }

/* Optional - Semantic Mediawiki - Hide Browse Property */
#t-smwbrowselink  { display:none !important; }

Wiki sidebar with indentions to display a hierarchy possible?[edit]

Can somebody help me with indentions in the sidebar to display a hierarchy? I am trying now since a few hours, without any success. The wiki sidebar should look like that:

  • Department 1
    • Team 1
    • Team 2
  • Department 2
    • Team 1

Is that somehow possible? Thanks for the help!

--Buler27 16:33, 7 February 2012 (Germany)

Version 2.0.2 breaks Editor on IE 7[edit]

Having a new install on MW 1.17 Using IE 7 no editor menu is shown at all. Chrome and FF are fine

Issues with MediaWiki 1.18.1[edit]

Been trying this recently with the newly upgraded TreeAndMenu. Unfortunately, still not working on my side despite multiple attempts.

Tree not showing in sidebar[edit]

I did everything from the installation-instructions. However, the tree is still not showing in the sidebar, it does if i preview MediaWiki:Sidebar

my MediaWiki:Sidebar contents:
{{#tree: *SDBApplication **SDBPlayer **CurrentPlaylist **CurrentSong **CurrentSongIndex **CurrentSongLength **CurrentSongList **isAutoDJ **isCrossfade **isEqualizer **isPaused **isPlaying **isRepeat **isShuffle **isStartingPlayback **LoadEqualizerPreset **Next **Panning **Pause **Play **PlaybackTime **PlaylistAddTrack **PlaylistAddTrackss **PlaylistInsertTrack **PlaylistCount **PlaylistDelete **PlaylistFocused **Previous **Stop **StopAfterCurrent **Volume **inPlaylist }}
edit: the JS file is included, its path is correct, but chrome says dTree is not defined
edit2: Both the menu and tree work in the preview, but nowhere else. site: mmss.peterelzinga.eu/wiki
edit3: I found that the JS is loaded after it is called... why isnt it included in the head?

Yes I agree... The JS is included "after" with the $wgOut->addScript() method, no matter the moment you call it. And that's a problem. dTree object is used before its declaration, and it deosn't work...
I made (for myselft) a little fix not perfect but that make the code runs (line 227).
$html = "$top<div class='$class' id='$id'>";
if( !$this->js++ ) {
  $html .= "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>";
}
$html .= "<script type=\"$wgJsMimeType\">/*<![CDATA[*/
  etc
  
And I removed the code :
if( !$this->js++ ) {
$script = "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>";
if( method_exists( $wgOut, 'addModules' ) ) $wgOut->addHtml( $script );
else $wgOut->addScript( $script );
}
And it works (for trees... menu still didn't work correctly with links) --80.11.52.77 16:02, 17 February 2012 (UTC)Reply
Code in 2.0.3 looks nothing like this, what version are you editing? 96.248.16.97
I've been try to adapt this code change for 2.0.3 without success, anyone else able to get 2.0.3 showing trees in Sidebar? 96.248.16.97
Still Broken 2.0.4
I have specifically avoided using this extension in the sidebar. For large trees, it doesn't display correctly, and as you have already found out, maintenance of the extension does not quite keep up with MediaWiki development. That is a problem for a lot of extensions, not just this one. I have brought up this issue in discussions for the extensions project, and I used this extension as my example because it is so popular. You can read it and add your comments here: WikiProject Extensions
Badon (talk) 04:02, 12 March 2012 (UTC)Reply
It appears that regular pages display the tree correctly, and the issues seems to related to the Sidebar with NavTree addition to the LocalSettings.php. This currently is injected with the hook : $wgHooks['SkinTemplateToolboxEnd"]. So logically mostly of the Sidebar page has been displayed including attempted trees before the NavTree page in injected (i.e. object before declaration, as said above). I don't know enough to do it myself, but couldn't the declaration be injected with a earlier/different hook, maybe "OutputPageBeforeHTML", so as to assure it is available? This is coming from someone who just wants this to work in the sidebar. :(

MediaWiki 1.18.1 TreeMenu Display problem[edit]

MediaWiki 1.18.1

PHP 5.3.9

mySQL 5.5.15

I have no display of my tree menu in an article.

Here is my tree shorted for brevity:
{{#tree:id=DI|root=Lean Design Control| *[[Design Inputs]] **[[Define Intended Use]] ***[[Intended Use Profiles]] ***[[Define Intended Use Needs]] ***[[Identify indications for use and contraindications]] ***[[Operational Profile]] ***[[Environment Profiles]] ***[[Product Safety]] ***[[Reliability]] **[[Identify Legacy Inputs]] ***[[Identify legacy products]] }} <noinclude>[[Category:Trees]]</noinclude>

HTML lists in trees?[edit]

I tried putting HTML list in trees instead of wiki-markup lists, but it didn't seem to work. Is this a planned feature? It's much easier to do complex stuff using HTML instead of fragile wiki markup. Badon (talk) 22:24, 22 February 2012 (UTC)Reply

Great extension![edit]

I'm loving this extension with Semantic MediaWiki. I'm using it to map out semantic relationships, so they're easier to navigate. The TreeAndMenu extension makes it visually clear and easy to see the entire "map" of semantic relationships. The only issue I'm having is when the size of the tree is very large, with hundreds of components, PHP's 30 second timeout is often reached. That's when the tree is on its own subpage, with nothing else going on. When it's on a more complicated page, Mediawiki's page size limits are reached, and the page won't load fully.

I've experimented with pre-generating the tree and just reusing it, but I have to manually update it when I do that. If there were some way that the tree could be set up to refuse to update itself until more than 5 minutes have passed (or whatever), that might help. Also, maybe there's some way the tree could be generated in portions, instead of all at once (or not at all) on each page refresh? This extension really shines when it is being used to visualize a large number of relationships, and if it's possible for it to do incremental updates, that would be amazing. The majority of the tree does not change, and when it does change, it's always just a few things at a time. I'm hoping there's a better strategy than regenerating the entire tree from scratch each time there is a change.

Badon (talk) 05:56, 4 March 2012 (UTC)Reply

Tree menu is showed only on Main page or during page creation[edit]

I've tried many times to find a solution for it but I did not have success.

Someone can tell me why the tree menu is showed only on Main page, during the page editing or on pages that were not created yet?

When navigating to all other pages already created the Tree menu is not showed. How can I change it to show the menu all time on all pages?

You can do that with a template, with Mediawiki:Sitenotice, or the sidebar. There might be other ways too. The sidebar tree doesn't work very well, or at all, so I don't recommend that approach. Badon (talk) 04:06, 12 March 2012 (UTC)Reply
The same problem here. Special:Version states the following: MediaWiki 1.18.0 and TreeAndMenu (Version 2.0.6, 2012-05-12) (Version 115616)
The wiki site source code contains the following
<div class='dtree' id='xmltree'></div><script type="text/javascript">window.tamOnload_tamxmltree=[]</script>
When editing the wiki page and doing the "preview", all is fine. After saving the page, nothing is shown, no list items, no symbols, no text.
What's wrong here? Any ideas? Dl8utl (talk) 17:09, 16 January 2014 (UTC)Reply

Brute Force TreeAndMenu in Sidebar?[edit]

I am not skilled enough to fix the script itself. I REALLY need trees in my sidebar. Until it is fixed correctly, I was giving my best effort to brute force loading of dtree.js in the all MW headers (it crashes). Obviously, I am over my head, but would appreciate any help.

In LocalSettings.php, I add:

# Brute Force dtree.js Loading into all headers
$wgHooks['BeforePageDisplay'][] = 'wfBruteForceLoadTAM';
function wfBruteForceLoadTAM() {
        $out->addScriptFile('$wgScriptPath/extensions/TreeAndMenu/dtree.js');
        return true;
}

Hide icons[edit]

Is there a way to hide the folder and page icons? --Catamarandreams (talk) 19:45, 8 April 2012 (UTC)Reply

Change the icons to blank transparent images, but kind of defeats the purpose IMO.
You can add
[id^="itamsitetree"] {height:0 !important;padding-right:5px !important;}
to common.css to remove the icons. edit padding to re-space menu items.
--github:c43 | 17:38, 14 October 2014

Tree disappears on page reload in MW 1.18[edit]

I got the Trunk version (rev.114144) to use it with MW 1.18, however there seems to be a major bug: The tree is displayed correctly, but after reloading via F5 it disappears. With a little debugging I found that ParserAfterTidy is not called for the page content on reload (due to caching) and somehow the scripts that are added by this hook via wgOut->addScript in line 266 (TreeAndMenu.php) are not in the cached page version (and the code that is used to generate the Javascript is neither).

I did some more debugging and by adding dtree.js and a 'position'=>'top' assignment to the wgResourceModules definition in the constructor, I was able to get it running in debug mode at least. However as I understand the migration guide troubleshooting tips, the dtree script must either be modified or wrapped to make the dTree constructor function visible in the global namespace (which might be the reason why it fails outside of debugging mode). - 80.156.43.136 11:10, 16 April 2012 (UTC)Reply
Any news on this one? I can´t use treeandmenu and also semantic treeview raises exception on MW 1.17 + php 5.3.8.
I am also seen this problem on MW 1.19, TreeAndMenu Version 2.0.6. It seems like the only way to fix it is to disable the parser cache. Does anyone know another solution? --Hulkenergy (talk) 16:51, 30 November 2012 (UTC)Reply

MW 1.18.1 or 1.18.2[edit]

Tree menu doesn't appear ! Have you a solution ? Thank.

Links not Working!

Hi, I tried to download the extension but always get an invalid response. Does anyone know if the links are broken? Thanks!

Cris

MW 1.18 + Sidebar TreeandMenu[edit]

I have been waiting on answers to the multiple posts on this page regarding trees in the sidebar. I was surprised to find a change on the main page...


As of MediaWiki-1.18, I've found a good way to get wikitext into the sidebar is to attach a function to the BeforePageDisplay hook with the following content:

function onBeforePageDisplay( $out, $skin ) {
	global $wgUser, $wgParser;
	$opt = ParserOptions::newFromUser( $wgUser );
	$title = Title::newFromText( 'Sidebar', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $wgParser->parse( $article->fetchContent(), $title, $opt, true, true )->getText();
	$out->addHTML( "<div id=\"wikitext-sidebar\">$html</div>" );
	return true;
}

This creates a CSS-addressable div element containing the parsed content from the MediaWiki:Sidebar article. You can then use some JavaScript added to your MediaWiki:Common.js to move the element into a more appropriate location in the page DOM. For example the following JavaScript snippet inserts the rendered wikitext below the site logo.

var tree = $('#wikitest-sidebar').parent();
$('#p-logo').after( tree.html() );
tree.html('');

I add these elements. I assume there is a typo here, wikitext instead of wikitest. In either case, I see my tree on the main page view for Sidebar, but never in the sidebar itself. Can anyone confirm the changes listed on the main extension page have worked for them in MW 1.18+ using 2.0.6?

This worked (sort of) for me in MW 1.19 and TreeAndMenu 2.0.6... I had to enable $wgAllowUserJs and correct the spelling as mentioned above, and it worked but crammed the entire page into the sidebar instead of just the wikitext-sidebar element. I corrected this by setting var tree = $('#wikitest-sidebar') instead of its parent. I also noticed that it didn't work at all on when the user preferencse page was displayed. --Goadeff (talk) 15:11, 20 June 2012 (UTC)Reply
I have a problem with the links to the articles. I've switched from CategoryTree to TreeAndMenu, which has the same categories as CategoryTree. When I create a new article and try to link it to a category, it does not appear in the TreeAndMenu sidebar, but in the CategoryTree one (which I had disabled). Any suggestions? I am using MW 1.19 and TreeAndMenu 2.0.6. Thanks in advance.

TreeAndMenu Tree not visible[edit]

Great extension!
I'm new to MW.
Working on Apache Win2008 Installed TreeAndMenu extension and all gone fine. No problem displaing Menu and viewing menu and tree in preview.

But after saving pages, to view tree i need to add "?action=purge" to the address bar.

I find the same problem with the extension MathJax
Adding this line "$wgParserCacheType = CACHE_NONE;" to LocalSettings.php solved for me.
Help. Thanks

Can't see the menu in 'Content' page.[edit]

When i'm previewd the page, i see the tree. but in the content page i can't! i see blank. Solutions: EMail me!

Fix when grid is not rendering[edit]

Hi guys,


I have experiences the problem that the grid didn't render unless i change LocalSettings.php.
Down here is the fix.

On the BOTTOM of LocalSettings.php, add:
require_once( "$IP/extensions/TreeAndMenu/TreeAndMenu.php" );
$wgParserCacheType = CACHE_NONE;

Add printable version[edit]

Hi guys,

I have noticed that the tree isn't configured to allow the list to be printed.

I have created a fix for this problem:

In TreeAndMenu.php, add the following lines just after:

	/**
	 * Constructor
	 */
	function __construct() {


Add these lines:

// BEGIN CUSTOM CODE TO ENABLE PRINTABLE VERSION
function curPageURL() {
 $pageURL = 'http';
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
$rest = substr(curPageURL(), -13);
if ($rest == "printable=yes")  return;
// END CUSTOM CODE TO ENABLE PRINTABLE VERSION



Tree in Sidebar Shows Bulleted Headers Below Tree in 1.19.2 (SOLVED)[edit]

I applied the 1.18+ code to get wikitext in the sidebar, and added the js code to get the tree to appear on the left, but each top-level tree branch shows up as a dead link below the tree. For example, a tree like this:

  • Black Tea
    • English Breakfast
    • Ceylon
    • Earl Grey
  • Oolong
    • Formosa
    • Pouchong
    • Ali Shan

Shows the full, working tree, but below that are headers:

black tea
oolong

It's as if the Sidebar is still trying to render the original elements.

Does anyone know how to fix this?

Edit: I managed to fix this by commenting out this line in Monobook.php:
$this->customBox( $boxName, $content );

1.19.2/2.0.6: Only history versions are running[edit]

On MW 1.19.2 the TaM 2.0.6 will not be displayed on the recent version of an article. Only a history version (oldid=xy) shows the Treeview correctly. Any ideas? --217.91.154.83 14:53, 3 December 2012 (UTC)Reply

tamsidebartree is undefined[edit]

When I have TreeAndMenu enabled my autocompletion goes away in the search box and I have an error that tamsidebartree is undefined.

I am using: Explorer: 8 MW: 1.20.2 TreeAndMenuJ: 2.0.6

My entire site revolves around TreeAndMenu. Thank you for the awesome extension. If I can help, let me know.

Thank you!

Margaret User:Amblerllc


Cannot add TreeAndMenu to Sidebar[edit]

Hello,

I've been trying for a while to add TreeAndMenu to my sidebar. I'm using the latest version of MediaWiki with vector skin, already tried the methods above and currently I'm trying with Extension:CustomNavBlocks and still the same. The Tree is not displayed in the Sidebar.

Any idea?

Thank you!

TreeAndView won't work with Vector skin[edit]

Is there a fix for using TreeAndViewwith the Vector Skin? Works fine with monobook.

Hi I am using Extension:TreeAndMenu for creating treeview in sidebar. Followed all the instructions provided in extension page and tree is getting dislayed good. But i am facing one small problem first level node contents are displayed again below the tree. One more issue is its just allowing me to use the page names as it is, not allowing to display custom page name. Mediawiki : v1.20.3 Any sugesstions would be helpful. Thanks and regards -- Chary

Menus not working on talk pages[edit]

We use the menus in a sidebar as navigation, but they do something weird on the history 'diff' page. Instead of appearing properly, they duplicate the entire page. If positioned at the top, this duplication overlays the page and makes it impossible to read.

Help?


--Aekki99 (talk) 15:12, 17 May 2013 (UTC)Reply

TreeAndMenu 3.0.4 2013-02-27 do not work in MediaWiki 1.20.5[edit]

Hello.

Sorry for my bad english.

TreeAndMenu do not work in my new MediaWiki 1.20.5. Example

Old TreeAndMenu 1.1.1 2009-07-29 in MediaWiki 1.16.0 work perfect with the same syntax.

What can i do?

Thank you.

How to download?[edit]

Your downloading instructions are not working:

--Maiden taiwan (talk) 13:47, 26 June 2013 (UTC)Reply

I updated the Extension:TreeAndMenu#Installation section to use svn. Maiden taiwan (talk) 14:10, 26 June 2013 (UTC)Reply

The #menu parser function is unknown in version 3.0.4[edit]

Version 3.0.4 of this extension does not define a callback for the magic word #menu. It only defines it for #tree

//TreeAndMenu.php line 61
$wgParser->setFunctionHook( 'tree', array( $this, 'expandTreeAndMenu' ) );

(However, TreeAndMenu.i18n.magic.php defines the magic word on line 9.)

So #magic is broken.

--Maiden taiwan (talk) 14:15, 26 June 2013 (UTC)Reply

Looks like #menu was intentionally removed in svn -r 1392 by nad. However, the docs on Extension:TreeAndMenu still list it as a feature. Maiden taiwan (talk) 14:22, 26 June 2013 (UTC)Reply
I removed #menu from the docs. Maiden taiwan (talk) 14:39, 26 June 2013 (UTC)Reply

TreeAndMenu does not work on latest (stable) Mediawiki with Vector skin[edit]

Tried different combinations and suggestions from the extension page and discussion page, had no success. Ended up with Fatal error: Call to undefined method VectorTemplate::addHTML() in /var/www/my_wiki/LocalSettings.php on line 161 being displayed instead of side tree after following 'Adding a treeview to the sidebar (if using Vector skin)' Also had to replace Article::fetchContent() with WikiPage.

Mediawiki 1.21.1, TreeAndMenu revision 1735

Showing Lines[edit]

After installing this I discovered it did not show the lines / grid which join the elements.

After reading through the code I finally realized that the script uses the following parameters:

  • $wgTreeViewShowLines

The default value is false. If you add the below to LocalSettings.php:

$wgTreeViewShowLines = 'true';

It will now draw in the grid as shown in the examples. It would be useful if this could be added to the documentation as I couldn't see if anywhere.

treeandmenu 3.1.2 not working with mediawiki 1.22.5[edit]

Treeandmenu 3.1.2 not working with mediawiki 1.22.5 in the sidebar. I have it as per instructions and i am able to get a tree in the sidebar but also on every page of the wiki. Also, when i click the tree on the sidebar nothing happens instead the tree in the page will respond. Look what i mean in this test wiki. http://tsili.byethost7.com/wiki/Main_Page

I modfied the js slightly which should fix it (diff), I made it only run after the document has loaded. --Nad (talk) 16:47, 20 August 2014 (UTC)Reply

help please.. #tree: is not working #menu: is working[edit]

Help please... My whole site is docs.safesquid.com ready except tree view. i have installed tree and menu extension, when i try to write like

{{#tree:
*Root1
**Sub-item
**Another sub-item
*Root2
**Sub-item
**Another sub-item
}}

its not working, after saving the page it is showing blank page.

as the same way when i try to write

{{#menu:
*Root1
**Sub-item
**Another sub-item
*Root2
**Sub-item
**Another sub-item
}}

it is giving proper output. i exactly want tree view with collapsable(+). How can i get this ?

Please tell me what should i do ?

A blank screen most likely indicates that a fatal error is occurring, but you have error reporting disabled. Try enabling error reporting, or check the web-server error log. --Nad (talk) 14:29, 23 September 2014 (UTC)Reply


help please.. #tree:view in the sidebar is not working[edit]

Hello Team,

I am new to MediaWiki and am trying out things like installing and configuring extensions. With TreeAndMenu(v3.1.2) extension, I am trying to get a 3 level Tree view in the sidebar on MediaWiki v1.23. As per the steps given in the extension's wiki page, I have placed the TreeAndMenu folder in the /extensions folder. Added the following code in LocalSettings.php as am using Vector skin.

 
    require_once( "$IP/extensions/TreeAndMenu/TreeAndMenu.php" );
    $wgHooks['SkinTemplateToolboxEnd'][] = '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', NS_MEDIAWIKI ) );
        $out = $psr->parse( $nav->fetchContent( 0, false, false ), $wgTitle, $opt, true, true );
        echo '</ul></div>' . $out->getText();
        return true;
    }
    $wgTreeViewShowLines = 'true';

added the styling in MediaWiki:Common.css as given in the extension's wiki page and following code in the MediaWiki:Common.js.

   $(document).ready( function() {
     var tree = $('#wikitext-sidebar');
     $('#p-logo').after( tree.html() );
     tree.html('');
   });

I am not able to get the tree view in the sidebar and I am not sure if there is anything else I need to do, to achieve this. I would really appreciate any kind of help.

Thanks in advance :)

The code you're using there is for the older version of MediaWiki (<1.18), use the code shown for 1.18+ and it should work. --Nad (talk) 01:01, 24 December 2014 (UTC)Reply


Thanks for the reply Nad. Made the suggested changes and also added the following code to MediaWiki:Sidebar page to get the 3 layered tree view in the sidebar.
{{#tree:id=siteTree|openlevels=1|root=Organic Design|
*Root
**Sub-item
***Another sub-item
}}

{{#tree:
*Root1
**Sub-item
***Another sub-item
*Root2
**Sub-item
***Another sub-item
}}

But not getting the desired output. Only getting Root, Root1 and Root2 as the headings (not having any content inside it). Please, help me resolve this or at least point me in the right direction. Thanks :)

First make sure the trees are working independently of the sidebar issue, do they work by themselves on other pages? If not you need to figure out what's wrong there before adding sidebar issues into the equation.
If they are working properly elsewhere, then try the sidebar - one problem I can see with your sidebar code is that in the tree wikitext you've specified the id "siteTree", but the JavaScript you've shown above uses "wikitext-sidebar", these need to match for the rendered tree to be placed into the sidebar area by the JavaScript. --Nad (talk) 11:46, 2 January 2015 (UTC)Reply
Thanks for the response. Changed the id. Now, the tree is coming on the top of the sidebar (containing root & structure in the page's content format) and the same root headings are also coming at he bottom of the sidebar's content (in the sidebar's content format), but just headings , nothing inside it and the top root structure is coming only on the /MediaWiki:Sidebar page. On rest other pages only the blank headings are coming in the sidebar.
Since you're using the MediaWiki:Sidebar article to put the tree in, MediaWiki will also display this content in the sidebar as usual, so it's best to use a different article for your tree such as MediaWiki:NavTree instead. Are the trees working properly when you just render them normally on a page? If not you need to get that working first. --Nad (talk) 15:29, 6 January 2015 (UTC)Reply
Thanks a lot it worked. :) Created a new article MediaWiki:NavTree and rendered the tree structure inside it.

Just one more query, as in the article MediaWiki:NavTree the tree is being shown in the organic design styling and as I am using vector skin for my wiki. So, I am wondering how can I change the styling of this tree to same as of the default vector skin?

You can add your own CSS rules into your MediaWiki:Common.css article, see the section Extension:TreeAndMenu#CSS_styles_for_trees_.28only_required_for_old_versions_of_TreeAndMenu.29 which shows what the default styles are so you can use that as a basis for adding some other refined rules. You could precede your rules with #mw-panel or #bodyContent etc to make trees in sidebar different to ones in the page (best to inspect the elements in the page to get the exact ids you want) --Nad (talk) 12:30, 7 January 2015 (UTC)Reply


Thanks, Nad for your prompt response. I am trying on things. Will trouble you again, if I face any issue. ;)

I dont get it to work inside the sidebar[edit]

I made a tree based on dpl and a category like this

{{#tree:id=SidebarTree | class=NavTree | root=Vendors | 
*Vendor Tree Test
**{{#dpl:category=Vendor|format=,**,[[%PAGE%]]\n,}}
}}</source
>

I had this tree is working inside a page. Then unfolded/folded by double clicking it. That's cool but I want to have it in my Sidebar.
Then my trouble started. The article describing it is not clear enough for me yet, I'm using mediawiki for 2 weeks now ;-). The result for now is that I change a lot of pages and now none of the #tree is working. Not in the page too.

I have a couple of code blocks but the location is not clear to me. This is what I have and thought where it should be. BTW I'm working with version 1.24.1.
<br />
'''Block 1'''. I thought this should be in the localsettings.php
<syntaxhighlight lang="php">
#TreeAndMenu
require_once( "$IP/extensions/TreeAndMenu/TreeAndMenu.php" );
$wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree';
function wfAddSidebarTree( $out, $skin ) {
	global $wgUser, $wgParser;
	$opt = ParserOptions::newFromUser( $wgUser );
	$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $wgParser->parse( $article->getContent(), $title, $opt, true, true )->getText();
	$out->addHTML( "<div id=\"sidebartree\">$html</div>" );
	return true;
}
$wgTreeViewShowLines = 'true';


Block 2. also added this to my MediaWiki:Common.js

$(document).ready( function() {
  var tree = $('#wsidebartree');
  $('#p-logo').after( tree.html() );
  tree.remove();
});


Block 3. THis is almost a copy of block 1, except for require_once line. I pasted this into MediaWiki:SidebarTree

$wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree';
function wfAddSidebarTree( $out, $skin ) {
	global $wgUser, $wgParser;
	$opt = ParserOptions::newFromUser( $wgUser );
	$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $wgParser->parse( $article->getContent(), $title, $opt, true, true )->getText();
	$out->addHTML( "<div id=\"sidebartree\">$html</div>" );
	return true;
}
$wgTreeViewShowLines = 'true';

Block 4. This code I pasted into MediaWiki:Common.css

/* CSS placed here will be applied to all skins */
.fancytree ul {
    background: none;
    border: none;
    font-size: 12px;
}
ul.fancytree-container {
    outline: 0;
    border: none;
    overflow: hidden;
}
.fancytree p {
    display: none;
}
span.fancytree-title {
    cursor: default;
}
span.fancytree-title a {
    color: black;
}

Block 5. This part I copied into MediaWiki:NavTree hoping to get an extra menu item in the sidebar.

* Testtree
{{#tree:id=SidebarTree | class=NavTree | root=Testtree |
*Vendor Tree Test
**{{#dpl:category=Vendor|format=,**,[[%PAGE%]]\n,}}
}}

Can you please help me out where the typo is or where my location is wrong.

Ok the instructions were a bit unclear in one aspect and had a typo too which I've changed now. The confusing part is that it's not clear that the id of the tree is not the same id as the PHP and JavaScript refer to, so I've changed the id to "wikitext-sidebar" so it's not confused with the id of the tree (which in your case id=SidebarTree). The id and class attributes in the tree itself are not involved in this, those are just useful for making different trees have different CSS styles.

To get a tree in your sidebar you need four blocks as follows:

  • 1) The wikitext to actually make the tree (your block 5) and put into MediaWiki:SidebarTree as you've done.
  • 2) The JavaScript to move the tree which goes in MediaWiki:Common.js as you've done. Problem: note the typo (my fault it was in the instructions) #wsidebartree, there should be no "w" since the PHP and the Wikitext don't use a "w". But I've changed this to "wikitext-sidebar" now to avoid confusion with the tree ID since its actually a container for the tree, it's not the tree itself.
  • 3) The PHP in your LocalSettings.php which adds the tree to all articles ready to be moved by the JavaScript. You've done this correctly in block 1, but you've also got another PHP section that you've put into an MediaWiki:NavTree, you can't have PHP in articles. That's not in the instructions and MediaWiki:NavTree isn't mentioned anywhere, so just delete that article.
  • 4) The CSS which can go in your MediaWiki:Common.css as you've done

So it looks like the only thing that would have been causing trouble is the "w" typo which was a problem with the instructions - sorry about that! It would have caused a JS error and halted further JS execution, hence the problem with none of the trees working anymore. --Nad (talk) 10:22, 2 April 2015 (UTC)Reply


OK, thanks for the quick reply. I have it almost working ... WHEN I open MediaWiki:Sidebar&action=edit it is shown above the normal menu. Unfortunately when I go to MediaWiki:Sidebar (just not in the edit mode) the tree is gone. Do you have any idea where to look? Mike Bijl

Use version 4.1.1 if the FancyTree JS is not running due to undefined $.widget[edit]

If anyone's getting a JS error re $.widget being undefined, then the latest version of TreeAndMenu (4.1.1 released today) will fix that. --Nad (talk) 18:01, 28 April 2015 (UTC)Reply

Possibility of adding fancytree extensions[edit]

Hey, i like this extension and it is very useful, but is it possible to add fancytree extensions to this extension - like extedit? Here is a link to the official fancytree extensions: https://github.com/mar10/fancytree/wiki/ExtEdit

Here is a demo: http://wwwendt.de/tech/fancytree/demo/index.html#sample-ext-edit.html

Yes you add them in the extension parameter, see the Usage section and look at how the persist extension is added. --Nad (talk) 16:47, 15 June 2015 (UTC)Reply

Open at current page not working[edit]

The provided code to open at current page does not work. The reason is that makeTitleVisible in jquery.fancytree.mediawiki.js is comparing the current title name with the stored fancytree node title. Unfortunately the node titles contain HTML (links) and so this does not work.

A hack to fix is to change

if(node.title == title) {

to read

if (node.title.includes('<strong class="selflink">')) {

This way, instead of comparing for current title, it is leveraging mediawiki's detection of links to the current page.

Squish (talk) 16:40, 9 June 2015 (UTC)Reply

Thanks for catching that, fixed in the latest version. I don't use selflink though as the makeTitleVisible should work for any title passed to it, not just work for the current page. Instead I'm selecting the first title attribute found in the node's HTML and comparing that with the passed title string. --Nad (talk) 16:49, 15 June 2015 (UTC)Reply
Mmmh, this is still not working for me. nt = $('a:first', nt).attr('title'); returns undefined for the current page and thus does not match title that has been set to the current title (mw.config.get('wgTitle')) --Planetenxin (talk) 13:40, 17 September 2015 (UTC)Reply

Working for 1.25?[edit]

I am trying to update our company wiki's to 1.25 but I can't get the TreeAndMenu to install. I have the new version downloaded from the .zip link from the main page. I am using the wfLoadExtension in the localsettings.php file.

Is this extension actually working? I noticed on the OrganicDesign wiki they are still using mediawiki 1.24.

Please let me know so I don't waste my entire week-end! :)

Thanks,

Margaret Lee

The main Organic Design site is running 1.24 and using the TreeAndMenu extension from the 1.24 branch, but I have it running on several 1.25's without any issue. Did you download the 1.25 version? what OS are you running? Check your browser console to see if any JS is failing to load or giving some indication of the problem. --Nad (talk) 21:16, 3 July 2015 (UTC)Reply
Oops I just found a problem with the download links: the git clone links were broken and the 1.25 zip link was pointing to the 1.24 branch. They should be correct now, after installing you should see version 4.2.0 in your Special:Version page. --Nad (talk) 21:49, 3 July 2015 (UTC)Reply
I still can't get the
wfLoadExtension( 'TreeAndMenu' ); 

to work but I can get

require_once( "$IP/../extensions/TreeAndMenu/TreeAndMenu.php" ); 

with REL1_25. I can try to re-download. Maybe I have my folders mixed up. It is difficult because I can.'t verify that my tree's are working because now I have figured out I have to re-write the css

Can you give examples of code to collapse nodes, add lines, and a top level icon? Thanks for your help again!

Margaret

If it's working with the require but not the wfLoadExtension, then you have the 1.24 version not the 1.25. Don't know why the CSS wouldn't load unless you're running windows in which case there could be quirks with path names. Try just pasting the CSS into your MediaWiki:Common.css article in the wiki instead. Expanding and collapsing nodes should just work by clicking the +/- icons, see the documentation for examples of options etc --Nad (talk) 14:42, 6 July 2015 (UTC)Reply

Issue with use with TreeAndMenu[edit]

This extension is great. Although it works correctly in the desktop wiki but in the mobile view with MobileFrontEnd extension. The usual sub-menus that normally automatically 'pop out' are not working.

TreeAndMenu adds some JavaScript libraries but don't have the mobile target and will not be loaded in MobileFrontend.

Could the TreeAndMenu extension updated to enable the required modules in mobile view?

Cheers

HOW TO FIX:

Add to extension.json

'targets' => ['mobile', 'desktop']

https://www.mediawiki.org/wiki/ResourceLoader/Writing_a_MobileFrontend_friendly_ResourceLoader_module#Enabling_your_existing_modules

CSS fix for icons[edit]

See https://github.com/OrganicDesign/extensions/issues/4. Cavila 10:24, 13 September 2015 (UTC)Reply

#tree displays no output in MediaWiki 1.25 - help?[edit]

In MediaWiki 1.25, the extension loads without error, but the #tree function does not display anything at all. This is with TreeAndMenu version 4.2.0, 2015-06-21. No errors appear in the PHP error log, nor in the browser's JavaScript console. Here's some example wikitext:

{{#tree:
*Item
**[[Sub-item link]]
**Another sub-item
}}

The #menu function seems to work, though the output is very bare-bones.

Any advice on how to debug? Thanks. --Maiden taiwan (talk) 18:21, 8 December 2015 (UTC)Reply

Flyout/collapsible for horizontal (suckerfish) menus?[edit]

Should this be creating flyout menus on horizontal (navigation) menu items? I have it working nicely as my main navigation, but nested list items don't properly nest.

  • Title
    • Section
      • Sub-section (what doesn't properly nest)

I'm on MW 1.25.2, and everything else with this looks good. (And the do nest properly when used in the sidebar - I'd just prefer them in the navigation menu up top.) --K_llandon 7 January 2016

Expanding and collapsing nodes[edit]

Hi I'm running MediaWiki 1.26.2 with TreeAndMenue 4.2.0 and most of the time i've to reloade the page multiple times to get node expanding/collapsing working. Is this a known issue? Are there any workarounds/fixes yet?

28.06.2016 08:00: Having the same problem. Tried refreshing jqery/js before pageload. No help. Seems like all code is loaded. Tried adding $(document).ready(function(){

$("div").css("border", "3px solid red");

});

in Common.js - this gets loaded. The Menu seems fine, but is just not responding after following a url to another article. Need to refresh several times to get it to work.


28.06.2016 08:15: Seems to have gotten it to work better. Workaround: Add the code you added to Common.js to top of the fancytree.js file in the exstensions folder.



29.6.2016: I've discovered a viable solution: instead of adding the tree to the sidebar with JS, just set the div style where you create the div that you're moving. The PHP for this from the extension's wiki is:

$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
$article = new Article( $title );
$html = $out->parse( $article->getContent() );
$out->addHTML( "<div id=\"wikitext-sidebar\">$html</div>" );

Change this to:

$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
$article = new Article( $title );
$html = $out->parse( $article->getContent() );
$out->addHTML( "<div id=\"wikitext-sidebar\" style=\"position:fixed; top:140px; left:0;\">$html</div>" );

Then open MediaWiki:Common.css and add the following to keep your tree menu from being on top of the irremovable "Tools" sidebar section:

div#p-tb{
  position:fixed;
  bottom:20px;
  left:0;
}

Alternatively, if you don't use the "Tools" sidebar section often/ever, like me, you could pseudo-remove it by putting the following in MediaWiki:Common.css:

div#p-tb{
  display:none;
}

Mjones44 (talk) 19:07, 29 June 2016 (UTC)Reply

Adding to Sidebar - MW 1.23.14[edit]

Hello,

first of all, this is a pretty usefull and cool extension.


The history (only if you're interested in it):

I startet using MW some weeks ago and tried to integrate this extension. On my own PC I am using xampp and MW 1.27.0 with TreeAndMenu 4.2.0 (the latest version).

Here, everything is fine. The tree was shown on the article "MediaWiki:Sidebartree" and I was able to add it via the "BeforePageDisplay"-hook and the Common.css to the Sidebar.

Now I wanted to migrate it to a server of our business. There I got the problems, that the PHP-version is not actual and I'm not allowed to upgrade it to the needed version (for MW 1.27.0).

So I was forced to get on MW 1.23.14. That's ok. After integrating the latest version of TAM I got some error messages, so I was forced to get an older version of TAM (from https://github.com/OrganicDesign/extensions/archive/MediaWiki-1.24.zip).


The problem:

Now the tree on "MediaWiki:Sidebartree" works fine, when I'm on this named article. But I was not able to get it loaded correctly via hook in the sidebar. (If it is neccessary, I'm using vector-skin.)


Here are my configurations:


MediaWiki:Common.css

.fancytree ul {
    background: none;
    border: none;
    font-size: 12px;
    top: 200px;
    left: -190px;
}
ul.fancytree-container {
    outline: 0;
    border: none;
    overflow: hidden;
    position: absolute;
}
.fancytree p {
    display: none;
}
span.fancytree-title {
    cursor: default;
}
span.fancytree-title a {
    color: #0044CC;
}


MediaWiki:Common.js

$(document).ready( function() {
  var tree = $('#sidebartree);
  $('#p-logo').after( tree.html() );
  tree.remove();
  /*tree.html('');*/
});


LocalSettings.php

#TreeAndMenu
wfLoadExtension( 'TreeAndMenu' );
$wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree';
function wfAddSidebarTree( $out, $skin ) {
	global $wgUser, $wgParser;
	$opt = ParserOptions::newFromUser( $wgUser );
	$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $wgParser->parse( $article->getContent(), $title, $opt, true, true )->getText();
	$out->addHTML( "<div id=\"sidebartree\">$html</div>" );
	return true;
}
$wgTreeViewShowLines = 'true';

What am I doing wrong? (excuse me for my bad english, please ... it's propably the worst you may read worldwide ^^')

Thanks for your help!


Radioaktiv_MD (22.07.2016)

Newlines removed on Edit[edit]

Hi, I am using TreeAndView with MediaWiki 1.26.2. Tree renders perfectly on first save but when I edit the page again, line breaks are removed (all code gets together) and Tree stops showing. When I again move each line starting with '{{' and '*' to the separate lines, Tree starts rendering again. Any idea why this is happening?

    UPDATE:
    I discovered that this problem was caused by WYSIWYG extension. This issue has been resolved in the latest version of WYSIWYG.

TreeAndMenu superpose when I edit or create an article.[edit]

Hello,

there is my problem, I just install the extension and configure in the sidebar, I used vector Skin and after a lot of time configuring vector.css, localSetings.php and included some functions to commonjs it's all ok, but I find a big problem, whe I try to edit some article, the tree show's on the same place that links to "mainPage", "recent changes", all is superposed... and the tree don't work.

COMMON.JS


$(document).ready( function() {
  var tree = $('#SidebarTree');
  $('#p-logo').after( tree.html() );
  tree.remove();
});

function ModifySidebar( action, section, name, link ) {
	try {
		switch ( section ) {
			case 'languages':
				var target = 'p-lang';
				break;
			case 'toolbox':
				var target = 'p-tb';
				break;
			case 'navigation':
				var target = 'p-navigation';
				break;
			default:
				var target = 'p-' + section;
				break;
		}

		if ( action == 'add' ) {
			var node = document.getElementById( target )
							   .getElementsByTagName( 'div' )[0]
							   .getElementsByTagName( 'ul' )[0];

			var aNode = document.createElement( 'a' );
			var liNode = document.createElement( 'li' );

			aNode.appendChild( document.createTextNode( name ) );
			aNode.setAttribute( 'href', link );
			liNode.appendChild( aNode );
			liNode.className = 'plainlinks';
			node.appendChild( liNode );
		}

		if ( action == 'remove' ) {
			var list = document.getElementById( target )
							   .getElementsByTagName( 'div' )[0]
							   .getElementsByTagName( 'ul' )[0];

			var listelements = list.getElementsByTagName( 'li' );

			for ( var i = 0; i < listelements.length; i++ ) {
				if (
					listelements[i].getElementsByTagName( 'a' )[0].innerHTML == name ||
					listelements[i].getElementsByTagName( 'a' )[0].href == link
				)
				{
					list.removeChild( listelements[i] );
				}
			}
		}

	} catch( e ) {
		// let's just ignore what's happened
		return;
	}
}

function CustomizeModificationsOfSidebar() {
	// adds [[Special:CategoryTree]] to toolbox
	ModifySidebar( 'add', 'toolbox', 'IndicE', 'http://wiky.pe.hu/wiki/index.php?title=Categor%C3%ADa:%C3%8Dndice' );
	// removes [[Special:Upload]] from toolbox
	ModifySidebar( 'remove', 'toolbox', 'Subir archivo', 'http://lpedia.tk/lpedia/eSpecial:SubirArchivo' );
        ModifySidebar( 'remove', 'toolbox', 'Printable', 'http://lpedia.tk/lpedia/index.php?title=P%C3%A1gina_principal&printable=yes' );
        ModifySidebar( 'remove', 'toolbox', 'Lo enlazado', 'http://lpedia.tk/lpedia/index.php?title=P%C3%A1gina_principal&action=info' );
        ModifySidebar( 'remove', 'toolbox', 'informacion de la pag', 'http://lpedia.tk/lpedia/index.php?title=P%C3%A1gina_principal&oldid=148' );
        ModifySidebar( 'remove', 'toolbox', 'CategoryTree', 'http://lpedia.tk/lpedia/index.php?title=Especial:CambiosEnEnlazadas/P%C3%A1gina_principal' );
        ModifySidebar( 'remove', 'toolbox', 'CategoryTree', 'http://lpedia.tk/lpedia/index.php?title=Especial:LoQueEnlazaAqu%C3%AD/P%C3%A1gina_principal' );
        ModifySidebar( 'remove', 'toolbox', 'CategoryTree', 'http://lpedia.tk/lpedia/index.php?title=Especial:Citar&page=P%C3%A1gina_principal&id=121' );
        ModifySidebar( 'remove', 'toolbox', 'CategoryTree', 'http://lpedia.tk/lpedia/index.php?title=Especial:P%C3%A1ginasEspeciales' );
}

jQuery( CustomizeModificationsOfSidebar );

vector.css


<style>
 
#p-tb { display: none; } 

 div#mw-panel { width: 250px; } 
 div#footer, #mw-head-base, div#content { margin-left: 12em; } 
 #left-navigation { margin-left: 12em; }

</style>

LOCALSETTINGS.PHP


#TreeAndMenu
wfLoadExtension( 'TreeAndMenu' );

$wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree';
function wfAddSidebarTree( $out, $skin ) {
        global $wgUser, $wgParser;
        $opt = ParserOptions::newFromUser( $wgUser );
        $title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
        $article = new Article( $title );
        $html = $wgParser->parse( $article->getContent(), $title, $opt, true, true )->getText();
        $out->addHTML( "<div id=\"sidebartree\">$html</div>" );
        return true;
}
$wgTreeViewShowLines = 'true';

$wgExtensionFunctions[] = 'wfAddCss';
function wfAddCss() {
    global $wgOut;
    $wgOut->addStyle( 'wide-sidebar.css', 'screen' );
}


any suggestions? Thanks for the extension¡¡¡

Tree not being displayed[edit]

Dear everybody,
Could you please have a glance at https://wiki.railml.org/index.php?title=CO:XMLtree?
On my computer, At most attempts, the tree is not being displayed; sometimes it is.
Is it displayed on your machine?
Do you recognize any error in the code causing the problem?
Thank you in advance!
Yours, Ciciban (talk) 09:51, 10 April 2017 (UTC)Reply

Solved :) — Ciciban (talk) 12:50, 2 May 2017 (UTC)Reply

Playground[edit]

Dear all,
Is there any public wiki where this extension is installed so I could test it in the usernamespace?
Thank you in advance for the answer.
Yours, Ciciban (talk) 10:20, 19 April 2017 (UTC)Reply

Extension not working[edit]

Dear all,
In our Wiki the extension does not work stable, as you can see here (compare source and rendering; don't be disappointed if it works for you by accident: after refreshing, it won't).
As you can see here, the extension version is rather old (2.0.6) — is this a smoking gun?
Another trace is, that I could not save this sample tree:

{{#tree: id=siteTree | class=navTree | root=Organic Design |
*Item
**[[Sub-item link]]
**Another sub-item
}}

The system returns:

Fatal error: Cannot access private property ParserOptions::$mEnableLimitReport in /kunden/403194_01013/webseiten/railml/wiki/extensions/TreeAndMenu/TreeAndMenu.php on line 152

But it works as soon as I leave away root=Organic Design |
Does anyone have a good hint?
Thank you in advance!
Ciciban (talk) 16:33, 21 April 2017 (UTC)Reply

Solved :) — Ciciban (talk) 12:50, 2 May 2017 (UTC)Reply

Differents Languages[edit]

Hi, it's possible to create a different sidebar deppending de language that it show's the Wiki?

Thanks Guindelo

Adding a tree to the sidebar in 1.29[edit]

As Article::getContent() is removed now, how we can add menu to the sidebar?

Solution[edit]

The solution I found was to re-add the getContent() in includes/page/Article, righta after the end of public function clear():

	/**
	 * Note that getContent does not follow redirects anymore.
	 * If you need to fetch redirectable content easily, try
	 * the shortcut in WikiPage::getRedirectTarget()
	 *
	 * This function has side effects! Do not use this function if you
	 * only want the real revision text if any.
	 *
	 * @deprecated since 1.21; use WikiPage::getContent() instead
	 *
	 * @return string Return the text of this revision
	 */
	 public function getContent() {
		$content = $this->getContentObject();
		return ContentHandler::getContentText( $content );
	}

Solution 2[edit]

In MediaWiki 1.32 I had success by replacing the call

$html = $out->parse( $article->getConent() );

in the event handler by the following line:

$html = $article->getPage()->getContent()->getParserOutput($article->getTitle())->getText();

Tree only shows in Sidebar in Edit mode in 1.30.0[edit]

When editing a page in source mode the tree will show in the sidebar. But when simply viewing pages it doesn't show.

I can add some regular text outside the tree in the MediaWiki:SidebarTree which will show. If I change the tag from #tree to #menu a menu will show in Read mode as well.

What am I doing wrong? I upgraded from version 1.28.2 to 1.30.0, where things were working fine.

LocalSettings.php:

$wgHooks['SkinBuildSidebar'][] = 'wfAddSidebarTree';

function wfAddSidebarTree($skin, &$bar ) {
    global $wgUser, $wgParser, $wgOut;
	
	$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $wgOut->parse( $article->getContent() );
	
	$bar[ 'FancyTreeNode' ] = "<div class=\"noglossary\" id=\"wikitext-sidebar\">" . $html . "</div>";
		
	return true;
}

MediaWiki:SidebarTree:

{{#tree:
*Item
**[[Sub-item link]]
**Another sub-item
}}

MediaWiki:Common.css

.fancytree ul {
    background: none;
    border: none;
    font-size: 12px;
}
ul.fancytree-container {
    outline: 0;
    border: none;
    overflow: hidden;
}
.fancytree p {
    display: none;
}
span.fancytree-title {
    cursor: default;
}
span.fancytree-title a {
    color: black;
}

Note: I had to modify Article.php and add the getContent() method again. Once everything is working again the plan is to use WikiPage.

I hope someone is able to help!

suckerfish/suckerfish.js is not loaded correctly[edit]

Why is the remoteExtPath of fancytree and suckerfish is loaded with $path/?

This causes a resourceloader exception in our wiki, the resourceloaders includes the js files as wiki/x/extensions/TreeAndMenu/extensions/TreeAndMenu/ instead of wiki/x/extensions/TreeAndMenu?

Should the code be $wgResourceModules['ext.fancytree']['remoteExtPath'] = __DIR__ . "fancytree";?

TreeAndMenu and "What links here"[edit]

Currently when I use this extension, every page appears for each other page on "what links here"... i.e. each page with a menu is treated as linking to each other page in the menu. Is it possible to stop this from happening? In Extension:Categorytree the links in the tree seem to be ignored for "what links here" purposes. Thanks. Jonathan3 (talk) 13:28, 5 April 2019 (UTC)Reply

I am using DPL3 to create the tree, so added eliminate=all and hope this will work... Jonathan3 (talk) 13:57, 5 April 2019 (UTC)Reply
Eliminate=all worked for DPL3 (once I'd fixed a bug in that) but TreeAndMenu must recreate the links somehow and undoes it... Jonathan3 (talk) 11:14, 28 May 2021 (UTC)Reply

White Screen of Death[edit]

Do you have any knowledge of your code triggering a white screen of death? I think I have narrowed down my database (coming from 1.26 using tree and menu code) flashing a white screen when I update to 1.33. Do you have any suggestions? I am using your master version.

Thank you! Margaret

404-Errors on loading icons[edit]

To solve this, you will have to change the line 59 in

TreeAndMenu/fancytree/fancytree.js

to

var path = mw.config.get('wgExtensionAssetsPath')+'/TreeAndMenu/fancytree';

TreeAndMenu and Math on same page[edit]

Using a MW 1.34.0 with TreeAndMenu 4.2.4, 2019-11-20 and Math 3.0.0 (b1a022f) I get UNIQ--postMath-00000001-QINU on math output if using {{#tree or {{#menu on same page. Any hint how to fix this?

Bug: Grid not showing[edit]

Unfortunately there seems to be a bug. None of the recommendations presented on the talk page worked for me: No grid lines are showing. Tested with the current master branch from github (2020-08-10).

Not working in MW 1.35.0-rc.3, php 7.4.10[edit]

My test article (normal page):

{{#tree:
*Article1
**Article1_1
**Article1_2
}}

(End of article) Actually, the subarticles, article1_1 and article1_2 are preceeded with double asterixes, although it does not look like that here.

Result: Page s displayed without any trace of the menu.

Browser debug console displays: load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:9 Skipped unresolvable module ext.treeandmenu resolveStubbornly @ load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:9 load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:2

Exception in resolve: load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:2 Error: Unknown module: jquery.effects.blind

   at sortDependencies (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:8)
   at sortDependencies (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:8)
   at resolveStubbornly (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:9)
   at Object.load (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:20)
   at load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:36
   at load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:36

logError @ load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:2 load.php?lang=is&modules=jquery%2Coojs-ui-core&skin=vector&version=gwrxj:144 JQMIGRATE: Migrate is installed with logging active, version 3.1.0

VM206:1 Uncaught ReferenceError: wgArticleId is not defined

   at <anonymous>:1:749
   at domEval (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:11)
   at runScript (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:13)
   at execute (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:14)
   at doPropagation (load.php?lang=is&modules=startup&only=scripts&raw=1&skin=vector:7)


Extracts from Localsettings.php:

$wgDefaultSkin = "vector";

# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );


# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'Cite' );
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'CSS' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'LocalisationUpdate' );
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'OATHAuth' );
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'Renameuser' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'TitleBlacklist' );
wfLoadExtension( 'TreeAndMenu' );
wfLoadExtension( 'WikiEditor' );


# End of automatically generated settings.
# Add more configuration options below.

Kind regards, Johann.

Add menu to sidebar error[edit]

Hello,

I'm trying to add the Tree Menu to the sidebar as explained on the extansion page so I added this to the LocalSettings.php:

$wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree';
function wfAddSidebarTree( $out, $skin ) {
	$title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI );
	$article = new Article( $title );
	$html = $out->parse( $article->getPage()->getContent()->getNativeData() );
	$out->addHTML( "<div id=\"wikitext-sidebar\">$html</div>" );
	return true;
}

but I get this error:

Fatal error: Uncaught Error: Call to undefined method OutputPage::parse() in /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/LocalSettings.php:167 Stack trace: #0 /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/includes/HookContainer/HookContainer.php(320): wfAddSidebarTree(Object(OutputPage), Object(SkinVector)) #1 /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/includes/HookContainer/HookContainer.php(131): MediaWiki\HookContainer\HookContainer->callLegacyHook('BeforePageDispl...', Array, Array, Array) #2 /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/includes/HookContainer/HookRunner.php(991): MediaWiki\HookContainer\HookContainer->run('BeforePageDispl...', Array, Array) #3 /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/includes/OutputPage.php(2610): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay(Object(OutputPage), Object(SkinVector)) #4 /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites in /home/clients/338f01990db03f8a1bb6a10eaf9098de/sites/wiki.eternitee.org/LocalSettings.php on line 167

How can I solve this?

There's some stuff about that here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/518296/
Maybe change "parse" to "parseAsContent"? Jonathan3 (talk) 22:41, 12 May 2021 (UTC)Reply
PS Just spotted very similar questions above :-) Jonathan3 (talk) 22:44, 12 May 2021 (UTC)Reply

Where to add the Hook code[edit]

Hello there !

Just begining with media wiki. I just do not get in which file I have to put this code:

$wgHooks['BeforePageDisplay'][] = function( $out, $skin ) { $title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI ); $page = WikiPage::factory( $title ); $html = $out->parseAsContent( $page->getContent()->getNativeData() ); $out->addHTML( "<div id=\"wikitext-sidebar\">$html</div>" ); return true; };

Any clarification is welcome, I would be happy to understand how it works ! Wirewalker.a (talk) 01:21, 9 September 2022 (UTC)Reply

You can add it to your LocalSettings.php 86.48.15.65 17:24, 23 April 2023 (UTC)Reply

Cant get tree to show in sidebar, instead shows on literally every other page.[edit]

Hi, i'm working on setting up a wiki, with which i'd like to have a nice sidebar navigation.

the plugin is installed and working properly, and i've added the relevant bits of code to my localsettings, and the bit of javascript to MediaWiki:Common.js

there is no tree in my sidebar, it does however show up on every single page at the bottom of the page.

this is probably a stupid question, but was i supposed to change anything in the code-example provided to make it match my own wiki? ideally i'd like to somehow just loop the tree into the 'default' sidebar somehow.

I've tried to see the source code on the organic design wiki for potential copy-pasting, but it's been disabled there.


Currently i'm stuck, and any insight would be appreciated.

edit: for what it's worth, i'm using the 'Citizen' skin.

89.72.41.40 10:48, 10 July 2023 (UTC)Reply