Extension talk:CategoryTree

Jump to: navigation, search

About this board


1 (2006/2007) - 2 (2008) - 3 (2009) - 4 (2010) - 5 (2011)

By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL

submenus sometimes hidden, sometimes not

Hboetes (talkcontribs)

I tried with various browsers on various operating systems and the subtree sometimes shows up and sometimes does not. I can't pinpoint what exactly causes the change in behaviour. I downloaded and diffed the html from the same page on a browser where I got to see submenus and one where I didn't and... there is no difference, apart from the random hashes. I suspect the javascipt is not being accepted. In the dev-console I got these error messages:

jquery.treeview.js?303:256 Uncaught ReferenceError: jQuery is not defined at jquery.treeview.js?303:256

(anonymous) @ jquery.treeview.js?303:256

SelectCategory.js?303:1 Uncaught ReferenceError: $j is not defined at SelectCategory.js?303:1

(anonymous) @ SelectCategory.js?303:1

I hope someone can fix this.

Reply to "submenus sometimes hidden, sometimes not" (talkcontribs)

When I use parents mode, the depth value doesn't seem to do anything-- my parent trees always render with a depth of 2, even when set to 4:

  | mode=parents
  | depth=4

How can I fix this?

Reply to "depth value in parents mode?"

$wgCategoryTreeMaxChildren don't show more than 200

Guindelo (talkcontribs)


I've a problem using $wgCategoryTreeMaxChildren, in my Localsettings i put a line wiith the number of pages to show $wgCategoryTreeMaxChildren= 400; but the categorytree only show's 200,

Any suggestions?



Reply to "$wgCategoryTreeMaxChildren don't show more than 200"

Setting $wgCategoryTreeMaxDepth doesn't work as expected

Summary by Ciencia Al Poder
Darek07 (talkcontribs)

I just found it that when I put in LocalSettings.php:

$wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 6, CT_MODE_ALL => 6, CT_MODE_CATEGORIES => 6);

and then on wiki

<categorytree mode=categories depth=4>Manual</categorytree>

it won't do any effects while setting it this way:

$wgCategoryTreeMaxDepth = 6;

will work! I'm using:

  • CategoryTree: master 2017-08-07T21:02:18 5474152
  • MediaWiki 1.30.0-alpha (26b883a)
  • PHP 7.0.21 (apache2handler)
  • MariaDB 5.5.52-MariaDB
  • ICU 50.1.2
Ciencia Al Poder (talkcontribs)

The code is checking if it's an array appropriately. Maybe in the new extension registration system the constants aren't accessible in LocalSettings.php yet?

define( 'CT_MODE_CATEGORIES', 0 );
define( 'CT_MODE_PAGES', 10 );
define( 'CT_MODE_ALL', 20 );
define( 'CT_MODE_PARENTS', 100 );

Try to use the constant values instead of the constant names, in case this is the problem.

Ciencia Al Poder (talkcontribs)

This is indeed the cause, as reported in task T152294

Reply to "Setting $wgCategoryTreeMaxDepth doesn't work as expected"
Marccreal (talkcontribs)

Sorry if this is a dumb question, but I do not find any possibility to display the whole category-tree of a wiki (not just all subcategories of a certain category). Is that possible?

Ciencia Al Poder (talkcontribs)

No, unless all categories have a parent category (except that parent category itself), in which case you can use that parent category and everything else will go below that. Of course you'll need to interact with the tree so it loads subcategories by clicking on them. Displaying the tree at once is probably not doable because there may be loops in the tree.

Reply to "Display all categories"

problem while loading data

Summary by Ciencia Al Poder

Extension:LockDown can cause issues when $wgGroupPermissions['*']['read'] = false;

Paul Hema (talkcontribs)

Moin moin.

The CategoryTree didn't find any subcategories. I hope the following image will show the problem:

While clicking "Erosion durch Wasser" (see the image) the correct pages an the subcategory appears.


Tacsipacsi (talkcontribs)

On which wiki did this occur? Is it persistent (have you tried it again as it told)?

Paul Hema (talkcontribs)


There are no changes when reloaded

Tacsipacsi (talkcontribs)

I meant can you give a URL for debugging?

Paul Hema (talkcontribs)

no sorry. It's under construction yet.

The CategoryTree version is

Paul Hema (talkcontribs)

I have updated the wiki from version 1.24. Maybe there is an old stuff of the previous version?

Tacsipacsi (talkcontribs)

Then please check your browser console. It can usually be accessed with the F12 key and/or Ctrl+Shift+I (if you can't find it, write me what browser you use and I try to find it out).

Tacsipacsi (talkcontribs)

If it's under construction, can't you delete the whole wiki and install the most recent versions with a clean installation?

Paul Hema (talkcontribs)
{"error":{"code":"readapidenied","info":"You need read permission to use this module","docref":"See https://fbs01/MethodenWiki/api.php for API usage"}}

The given link throws a 500 error.

Paul Hema (talkcontribs)

Oops. Here is the cmd answer:

What's wrong?

Tacsipacsi (talkcontribs)

The web error message says that you don't have read permission through the API (while you obviously have through the normal HTML interface). This can be somehow CategoryTree's code error if your wiki's private (i.e. anonymous users can't read pages). It was designed for Wikipedia, where read access is not a problem. The command line error is OK, api.php isn't designed for command line access (it wants to access $_SERVER which I think is an empty array or something like that). For development, you can set $wgShowExceptionDetails = true; in LocalSettings.php (it's not recommended for production use!), although it won't produce any error message in this case, since it's not an error in PHP level.

Paul Hema (talkcontribs)

Ok, it is a private wiki. So it can be a code error in CategoryTree. I think i have to live with this problem.


Tacsipacsi (talkcontribs)

No, the developers should fix it. I reported here.

Ciencia Al Poder (talkcontribs)

Maybe you're using Extension:LockDown? (would be a dupe of task T148582 in that case)

Paul Hema (talkcontribs)

Yes :-(

The problem is the restriction with

$wgGroupPermissions['*']['read'] = false;

How to keep CategoryTree stayed opened after clicking any category in sidebar in Vector skin?2

Satyamcompany (talkcontribs)

When I am going down in one category and subcategories (depth 5-6), after loading the specified category and then hitting the "back" button on the browser , the category tree is folded again. Is there any chance the tree stays opened? Please reply ASAP... How to keep nodes expaneded even after clicking back button in browser.Any code changes to be done in Categorytree extension? It would be great to have the tree expanded to the current page after clicking any article , so that the users can get a quick impression about the location of the current article in the overall context. (talkcontribs)

iam also facing same problem.., any solution??

CoolCornucopia (talkcontribs)

Hi, I did a small dev to offer this feature to everybody. Please refer to "CategoryTree in Sidebar stayed opened". Do not hesitate to comment :-)

This post was posted by CoolCornucopia, but signed as Cornucopia. (talkcontribs)


I can't get it to work. Is it all to just copy the JavaScript to ext.categoryTree.js ?

CoolCornucopia (talkcontribs)

Hi, in the version of CategoryTree I am using, it is not the file ext.categoryTree.js but the file CategoryTree.js.

Be sure you are using a similar version of CategoryTree else you may need to merge my modifications.

FYI, sometimes it does not work with recent IE due to the default compatibility mode set to a "too old" IE version (the IE "intranet mode" can also introduce such "too old" IE version). Tell me if it solves your issue. Best Regards

This post was posted by CoolCornucopia, but signed as Cornucopia.

CoolCornucopia (talkcontribs)

Hi, I am porting my patch to Mediawiki 1.22.2 and the related CategoryTree extension. I keep you in touch. Best regards.

This post was posted by CoolCornucopia, but signed as Cornucopia.

CoolCornucopia (talkcontribs)

Hi, now it works on Mediawiki 1.22 too :-). Please refer to "CategoryTree in Sidebar stayed opened". Do not hesitate to comment :-)

This post was posted by CoolCornucopia, but signed as Cornucopia. (talkcontribs)

Hi Changed ext.categoryTree.js as you have written, but does not work in sidebar and "in-page" category trees too. What could be wrong? MediaWiki version 1.22. Tried in Mozilla, Chrome, IE.

CoolCornucopia (talkcontribs)

Hi, I have "re-tried" from scratch and it works fine for both sidebar and "in-page" category trees. I use Mediawiki 1.22.2 and the related CategoryTree extension. You may have a look to your cookies when folding/unfolding categories... Best regards

This post was posted by CoolCornucopia, but signed as Cornucopia. (talkcontribs)

Hi. Does not work your modification. I would like to know, when you open a category in CategoryTree, change variable date-ct-state in the page source or not?

CoolCornucopia (talkcontribs)

This post was posted by CoolCornucopia, but signed as Cornucopia.

Starws (talkcontribs)

Hello! I tried to modify the file ext.categoryTree.js (i just added lines that were marked in yellow for version 1.22) but it does not work. Is there any solution? Help me please! :)

Mediawiki 1.28

Reply to "How to keep CategoryTree stayed opened after clicking any category in sidebar in Vector skin?2"

Allow the state of the tree to be maintained across page loads

Starws (talkcontribs)

Is it possible to allow the state of the tree (in sidebar) to be maintained across page loads?


TreeAndMenu extension

ExtPersist plugin

Reply to "Allow the state of the tree to be maintained across page loads"

Get the parent category(ies) of the current category page

ClemFlip (talkcontribs)

Hi Friends, thanks for this great extension.

I am looking for a magic word to get the parent category(ies) of a category page.

Is there a way to do that?


ClemFlip (talkcontribs)

Ok, forget about it!

I just solved it with: <categorytree mode=parents>CATEGORY NAME</categorytree>

Change CategoryTree's position in sidebar

3 (talkcontribs)

I included a category tree in the sidebar by using <code>$wgCategoryTreeSidebarRoot = "mRootCategory"</code>. However, the category tree only shows at the bottom of the sidebar. Is there any way to move it up? (talkcontribs)

Same problem. Below I see some changes were done to fix this problem in ext.categoryTree.js, but it's still not working. I tried to use different skin, samething. (talkcontribs)

There is a small note on the doc page that describes how to set this:

If you want the CategoryTree on a different position in the sidebar, you can reference it on MediaWiki::Sidebar as "categorytree-portlet".

I've missed this several times before finally noticing!

Reply to "Change CategoryTree's position in sidebar"