Extension talk:CategoryTree

Jump to: navigation, search

About this discussion


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
AmazingTrans (talkcontribs)

How can i insert the categoryTree to the right of the Contents box? Also, can i encapsulate the categoryTree in a box like the Content?

Reply to "Insert CategoryTree right of Content?"
Amichai Nachmani (talkcontribs)

Is there a way to hide hidden categories from the tree?


Reply to "Hide hidden categories"

Split a long list into Multi-Column Lists

Samuel Goujon (talkcontribs)

Hi all,

Would it be possible to split a long list into multiple horizontal columns?

For example, every 50 categories, a new list is created on the right (keeping the alphabetical order)

Thanks for your help!

Reply to "Split a long list into Multi-Column Lists"
Grerika (talkcontribs)

Hi all, Is it possible to replace ► sign with +? My users does not find it obvious that ► is for expanding.

Siebrand (talkcontribs)

There are 3 system messages that MediaWiki administrators can change to get the behavior you desire:

Reply to "Replacing ► with +"
Grerika (talkcontribs)

Hi, I really like this extension! I am wondering if it is possible in pages mode to show only pages which have given default form. I mean something like this: {{#categorytree: [[Page has default form::Person]] Person|mode=pages}}

Reply to "Only show pages with specific form"

Fix for making CategoryTree work in sidebar again with MW 1.24.1 and Vector skin

Bhuber (talkcontribs)

Hi all, I used to offer a CategoryTree in my MediaWiki sidebar with MW 1.20.4. Everything worked well, but since my update to MW 1.24.1 all appropriate releases of CategoryTree stopped working in the sidebar. This includes the REL1_24 version but also the development master version. The problem is, that the expandable symbols are not shown at all and no click handle is registered. Interestingly CategoryTree works perfect as part of a WikiPage in parallel to not work at all in the sidebar.

I figured out that the way how the ext.CategoryTree.js works is that it uses a mw.hook to access the WikiPage content and to make CategoryTree working there. But obviously the sidebar is not part of the content which is access by this approach. I tested it by just removing the whole content in the ext.CategoryTree.js and literally just the inner section of my page disappeared but the sidebar was still there together with some other navigation content. So I am looking for a fix to have ext.CategroyTree.js to access the whole content including the sidebar.

I am no MediaWiki nor js nor php specialist, but after looking into the vector skin, I figured out how the skin accesses the whole content. I decided to give this appraoch a try, so I modified the beginning of ext.CategoryTree.js (which is located in extensions/CategoryTree/modules by the way) to make it look like this:

//( function ( $, mw ) {
//   mw.hook( 'wikipage.content' ).add( function ( $content ) {
jQuery( function ( $ ) {
                * Sets display inline to tree toggle
               function showToggles() {

and the end of ext.CategoryTree.js to look like this;

        // Register click events and show toggle buttons
        $( '.CategoryTreeToggle' ).click( handleNode );
   } );
//}( jQuery, mediaWiki ) );

From my understanding this gives the ext.CategoryTree.js access to the whole page content. So good news is, that everything works well after this modification, CategoryTree in the sidebar works like expected.

So now I have a question to all MediaWiki specialists: is this a valid approach to solve the problem? Or does it cause tremendous load to the system or break system concepts?

David6243 (talkcontribs)

I think a crucial change is missing from the js code you posted, something like:

jQuery( function ( $ ) { var $fullcontent = $(this);

And later, access fullcontent instead of content, e.g.

function showToggles() { $fullcontent.find( 'span.CategoryTreeToggle' ).css( 'display', 'inline' ); }

Anyway, the hints about the sidebar not being part of the content and looking at vector.js for reference were very helpful to me, and I can now show a category tree anywhere in the skin. Thanks!

As for your question: Don't know. I haven't noticed any problems.

Also, sorry about editing the subject of your post. Initially, I couldn't respond because of this:

This page can only be edited by users with the autoconfirmed right because it matches the following title blacklist entry: .*Make.*cat.* autoconfirmed

By now, my account is confirmed. Changing the subject hadn't helped either.

Bhuber (talkcontribs)


you are absolutely right, for some weird reason I missed to add two really important changes...

Generally speaking, you want to replace any use of the term $content.find by a single $, which refers to the whole DOM from my understanding. This needs to happen two time in the ext.categoryTree.js:

               function showToggles() {
                       $content.find( 'span.CategoryTreeToggle' ).css( 'display', 'inline' );

needs to be modified to look like this:

               function showToggles() {
                       $( 'span.CategoryTreeToggle' ).css( 'display', 'inline' );


               // Register click events and show toggle buttons
               $content.find( '.CategoryTreeToggle' ).click( handleNode );

needs to be modified to look like this:

               // Register click events and show toggle buttons
               $( '.CategoryTreeToggle' ).click( handleNode );

So there is absolutely no need to search or build another $content var, obviously you can work on the whole DOM like the skin sample does.

PS: There is absolutely no need to excuse for making my post usable to you and others by doing whatever is required...

Reply to "Fix for making CategoryTree work in sidebar again with MW 1.24.1 and Vector skin"
Monic abc (talkcontribs)

Is there any option to sort articles' names in such order as below?

I have now:

  xxx 1 yy
xxx 10 yy
xxx 11 yy
xxx 2 yy
xxx 20 yy
xxx 3 yy

And I want this:

  xxx 1 yy
xxx 2 yy
xxx 3 yy
xxx 10 yy
xxx 11 yy
xxx 20 yy
Dennis J au (talkcontribs)

Have you looked at these help files...

  1. Help:Categories#Sort_key and...
  2. Help:Sorting...?
Monic abc (talkcontribs)

Yes, but I don't know how to use these tips. I tried do sth like this:


but it doesn't really works - nothing has changed. ("Levels" is my category with articles)

Dennis J au (talkcontribs)

I'm not a programmer, but when you add your articles to your "Levels" category you do it by adding something like this...


... to your article page.

If your article needs to be at the top of the sort list, e.g. for 'xxx 1 yy' do this


The '1' after the pipe character '|' is a 'sort key' which will bring the article with that key to the top of the sort.

For the rest of the articles in your example, just make the sort key equal to the number of the article, like this

For article 'xxx 10 yy' make the sort key '10' by adding the following to that article's page...


For article 'xxx 11 yy' add this...


for 'xxx 2 yy' add this...


for 'xxx 20 yy' add this...


for 'xxx 3 yy' add this...



Try that and see how it goes.

Monic abc (talkcontribs)

Thanks a lot! I thought that I have to edit some options in line with CategoryTree, not article's category. What works for me:


Number without brackets didn't work, so I used this "[number]".

Reply to "Sorting articles in category - numbers"
Skontakt (talkcontribs)

Is it possible to make Category and Subcategory link with expand functions. And disable link to category page.

Dennis J au (talkcontribs)

There have been a number of requests for this feature to be added to CategoryTree, see here... Thread:Extension talk:CategoryTree/Suggestion: CategoryTree enhancement for touch screens from May 2013 and here... Thread:Extension talk:CategoryTree/Suppress links to categories, only link to pages. from Oct 2013. Perhaps if someone logged a bug with this feature request it might get actioned? I don't understand Mediawiki extension development and enhancement processes.

Reply to "Category link to expand functions"

Problem loading data. Please wait a moment and try again

Wmat (talkcontribs)

With MW git master + CategoryTree git master, my category tree shows one level. Clicking on the arrow produces the message: Problem loading data. Please wait a moment and try again

If I turn on debugging, I see the following in the backtrace:

[GlobalTitleFail] MessageCache::parse called by CategoryTreePage::execute/Message::parse/Message::toString/Message::parseText/MessageCache::parse with no title set.

Could be related to this: https://phabricator.wikimedia.org/T25307

Dennis J au (talkcontribs)

There is a bug logged directly relevant to this: T44938 Expanding widgets fails for numerical-only categories with "Problem loading data", no request sent

The problems is still present in MW 1.24.0

If you look at this bug log, a user known as Schnark has noted that there is a problem with some Javascript code that turns numeric categories into 'null' titles. This situation would tie in with your debugging backtrace message.

Of course there could be more to your problem than this.

Wmat (talkcontribs)

I got this fixed today. It turns out that HotCat from https://commons.wikimedia.org/wiki/MediaWiki:Gadget-HotCat.js fixed my issue. There must be some caching going on somewhere though as it took a number of hours for my wiki to start working again. Apparently this problem struck Commons around Jan.14th or so. Hence, the updated HotCat.

Reply to "Problem loading data. Please wait a moment and try again"
Kmacdowe (talkcontribs)

After installing CategoryTree (Mediawiki 1.23) on my Special pages, I am seeing <categorytree> as a link. Anyone know how to fix this? The extension is working fine other than that.

Kghbln (talkcontribs)

This means that MediaWiki:Categorytree is missing though this is pretty strange. I have seen this on the Wiki of the Free Software Foundation, too. Probably some other extension you installed does not play with the CategoryTree extension.

Kmacdowe (talkcontribs)

Thanks kgh. It is installed, and the tag works on my regular pages so this isn't a show stopper but it is odd. Thanks for the help.

Reply to "&lt;categorytree&gt; in Special pages"