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

Preserve expand/collapse state across pages?

DavidBiesack (talkcontribs)

if we use CategoryTree for a navigation box on a set of pages within a category with multiple subcategories, is there any way to preserve the expanded/collapsed state across page views? The desired effect is similar to using an HTML frameset, with the category tree in one frame on the left, and the navigated content in a frame on the right, but ideally done within the standard MediaWiki model

Reply to "Preserve expand/collapse state across pages?"

How to show pages in the last subcategory in CategoryTree

1 (talkcontribs)

Hello all! I have a page that included to several Categories, for Example (Tenses in English language that included to following categories: Category:Foreign Languages, Category:English, Category:English Grammar, Category:Tenses in English). And I made subcategories, so it looks like:

▼ English
....▼ English Grammar
......... [×] English Tenses
......... [×] General rules of English

So in this case I have mode=categories, but if I make mode=pages then all pages are shown in every category which looks not so nice. Is it possible to show pages only in last subcategories (they are marked with " [×] ")? so I want users to open last category in the list to see the pages included to this category. How to make it?

Reply to "How to show pages in the last subcategory in CategoryTree"

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.

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

I had a 321 member category that wouldn't display all of its members. I am running Mediawiki 1.25.1. I finally got it to work by adding a large enough value for $wgCategoryPagingLimit (default value is 200) into LocalSettings.php.

require_once( "$IP/extensions/CategoryTree/CategoryTree.php" );
$wgUseAjax = true;
$wgCategoryTreeMaxChildren = 400;
$wgCategoryPagingLimit = 400;
Reply to "Long lists missing members"

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!

Cmjohannes (talkcontribs)

I would also like to know if this functionality is possible. I have a category with 300 member pages, which I would like to display on my main page. Currently, the CategoryTree extension displays one page per line. I would like to use a four or five column table to improve site aesthetics and make the list more readable.

Something like:


<tr><td>Page A</td><td>Page B</td><td>Page C</td><td>Page D</td></tr>

<tr><td>Page E</td><td>Page F</td><td>Page G</td><td>Page H</td></tr>


Where/how could/should such display output be implemented?

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

In my wiki we use the category tree extension dynamically in a few pages to have convenient links to other pages. This means when people create new pages, all they have to do is add the appropriate category to their page and then the link will show up automatically on the master page. This saves our users time as they don't have to worry about manually adding links or link rot.

Unfortunately pages that a linked to in this way do not count under 'what links here' and therefore also show up on the orphaned page list. This makes it more difficult for the wiki admins to see if a particular page is dead/cruft that can be deleted (as usually pages with no links to them are) because it may actually be a valuable page that is only linked to via a the category tree expansion.

Is it possible for this extension to have this functionality added? I guess it would need to be configurable, as not all wikis may want this behaviour by default. (talkcontribs)


Reply to "What links here / Oprhan pages"

Custom pictograms for expanded and collapsed nodes

4 (talkcontribs)

Hi! I searched in CategoryTreeFunctions.php and .js and .css files but failed to find where may I change what is displayed near the category name. I want to replace [+] and [-] with my own pictograms because such text signs look a little bit poorly. Thank You for any help and clues.

CoolCornucopia (talkcontribs)

Hi, I suggest you to have a look to my home page where I describe a solution User:Cornucopia#Tips:_Change_collapse.2Fexpand.2Fempty_images_in_the_CategoryTree. Then, simply change the png with your own images : )

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

Thanks, thats what I've been looking for, but You do not say where to put that code. Could You specify the file I need to modify? Thanks.

CoolCornucopia (talkcontribs)

Hi, heading title names are the wiki page names to create :-) Br

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

Reply to "Custom pictograms for expanded and collapsed nodes"

CategoryTree extension and Mediawiki v1.20

6 (talkcontribs)

The CategoryTree extension page defines that this extension is available to Mediawiki V 1.13.

Does it works with more recent mediawiki updates such as v1.20?


Kghbln (talkcontribs)

Heiya, I would guess so. I just changed the info box a bit to make this more clear. Since Wikimedia is using this extensions on their wikis and they are already on the MW 1.21 branch it should definitely work for MW 1.20. Cheers

Rob Kam (talkcontribs)

It's not working here on 1.21, try it out at Special:CategoryTree/Top_level.

This post was posted by Rob Kam, but signed as Robkam.

Kghbln (talkcontribs)

Ah I see. I guess or better hope that a bug was filed for this. Cheers

Rob Kam (talkcontribs)

Bugzilla:43253 now fixed :-)

This post was posted by Rob Kam, but signed as Robkam.

Reply to "CategoryTree extension and Mediawiki v1.20" (talkcontribs)

I try to view a tree of categories, nothing works. I have followed all the instructions; I can go to Special:CategoryTree but when I enter a category name, it doesn't exist.

Pages are created for all categories.

Help... Any help...

I'm hosted on HostGator using these versions: MediaWiki v1.20.0 PHP v5.3.15 (cgi-fcgi) MySQL v5.5.23-55

I downloaded CategoryTree just today as instructed.

Axanon (talkcontribs)

I have the same problem with CategoryTree (ac61645). I'm running Mediawiki 1.20.1, PHP 5.4.9, MySQL 5.5.28. In addition to Special:CategoryTree not working, I cannot use the <categorytree> tag either. Axanon (talk) 21:49, 3 December 2012 (UTC)

Axanon (talkcontribs)

I just realized that this extension is not currently supported on Mediawiki versions > 1.18 (yet?) Edit: This snapshot appears to be working 75d974a. It is the same version used by this wiki. Axanon (talk) 22:57, 3 December 2012 (UTC) (talkcontribs)

I am using Strict Standards: Declaration of CategoryTreeCategoryViewer::addSubcategoryObject() should be compatible with that of CategoryViewer::addSubcategoryObject() in C:\PlayNet\Wiki4Playout\extensions\CategoryTree\CategoryPageSubclass.php on line 14 Catchable fatal error: Argument 2 passed to CategoryViewer::__construct() must implement interface IContextSource, null given, called in C:\PlayNet\Wiki4Playout\extensions\CategoryTree\CategoryPageSubclass.php on line 9 and defined in C:\PlayNet\Wiki4Playout\includes\CategoryViewer.php on line 78

Banaticus (talkcontribs)

Darn, so it was sort of a waste of time for me to install it then? I just came here looking for help to get it working, but if it's not working for more recent Mediawiki installations, then there's no real point in continuing with it. (talkcontribs)

I get version from July 2010 and that works almost! In order to makes click on categ and sub categ working I add on CategoryPageSubclass.php on class CategoryTreeCategoryPage in function closeShowCategory a test for on both variables $from and $until then I let call of new CategoryTreeCategoryViewer. but it lets destruction of css style and sidebar is not working also anymore

2600:1010:B11D:5C3B:9856:A19B:66B6:DB14 (talkcontribs)

I'm not sure I understand what you did. I don't need sidebar or anything like that working, I'd like to implement your fix. Could you post a little more detail on it or perhaps the modified file (or a link to it)?

Jm.lefevre (talkcontribs)

I also get the version 75d974a and it work in any page with mediawiki 1.20.2, but not into sidebar. I've tries to debug it, but didn't find the problem. Anyone have an idea where to look at ?

Daniel K. Schneider (talkcontribs)

Same here:

  • the default current (Dec 11 2012 snapshot) doesn't work at all
  • Version 75d974a works, but not in the sidebar.

MediaWiki 1.20.2 PHP 5.3.2-1ubuntu4.18 (apache2handler) MySQL 5.1.66-0ubuntu0.10.04.1


  • An old version I used with 1.18.x version does work :) But I can't figure out the version number..
Jm.lefevre (talkcontribs)

Can you post it somewhere ... maybe a diff will make me find how to make it work with sidebar

Tiggerjay (talkcontribs)

I am new to using GIT and older versions, can someone help direct me how to download the older 75d974a version? Thanks

Jm.lefevre (talkcontribs)

You can use the link from Axanon (talk) on the ‎3 décembre 2012 à 22:45 just above. Then click on snapshot link on the opened page

Daniel K. Schneider (talkcontribs)

Working solution fo MediaWiki 1.20 !

Sorry, I didn't follow this thread, therefore I didn't post a diff. Anyhow, today (6 month later) I tried again

Same problem as before. After upgrading the categories would not show in the sidebar. Since there wasn't any code change with respect to this JavaScript "error:categoryTreeLoadChildren is not defined", I played with all sorts of config settings and bingo I found one that works:

# Extension: Categorytree
$wgUseAjax = true;
$wgCategoryTreeSidebarRoot = "Contents";
$wgCategoryTreeForceHeaders = true;
$wgCategoryTreeDynamicTag = false;
$wgCategoryTreeDisableCache = false;
$wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 2, CT_MODE_ALL => 2, CT_MODE_CATEGORIES => 3);

See http://edutechwiki.unige.ch/en/

BTW this also makes the category tree work with Semantic Forms. My prior config did not !!


Edga~mediawikiwiki (talkcontribs)


I tried your solution which still doesn't work for me. I do not see "categoryTreeLoadChildren is not defined" anymore, but my <categorytree> tag is still not being replaced with the actual tree. However if I go to Special Pages -> Category Tree and put my category name, the preview will show it just fine. What can be the reason?

And it also works if I use this syntax on a page

Category Foo not found
 but it doesn't on sidebar. What could be the reason?

This post was posted by Edga~mediawikiwiki, but signed as Edga.

Daniel K. Schneider (talkcontribs)

Sorry I can't help here since I run MW 1.22 now and the latest GIT code for all extensions. However, the setting above is still the same :)

Reply to "no categories!"
DavidBiesack (talkcontribs)

Is there some way to reverse the order of the items? We use our internal wiki to record meeting minutes, so a category will have articles with names using the <topic> minutes yyyy-mm-dd pattern (using mode=pages). CategoryTree sorts alphanumerically in ascending order, but I'd like an option so that the most recent meeting is listed first, not last. thanks

CoolCornucopia (talkcontribs)

In case there is no "reverse order" feature in the CategoryTree extension, I suggest to use {{DEFAULTSORT:sortkey}} in all your meeting minutes articles (see https://www.mediawiki.org/wiki/Help:Magic_words for more details). For instance, add {{DEFAULTSORT:999}} in a new meeting minutes and add {{DEFAULTSORT:998}} in the next meeting minutes and so on... Of course, you have an extra work for previous meeting minutes articles but for new meeting minutes, it should not be so much work :)

Note that DEFAULTSORT works for both articles and categories so I do not use DEFAULTCATEGORYSORT (MediaWiki 1.17). Hope it helps :-)

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

DavidBiesack (talkcontribs)

DynamicPageList provides the ability to sort in descending order.

Reply to "sort in reverse order?"