Extension talk:CategoryTree

From MediaWiki.org
Jump to: navigation, search
Start a new discussion
First page
First page
Previous page
Previous page
Last page
Last page

Reasonable Expectation for $wgCategoryTreeCategoryPageOptions

Here's my setup:

Product Version
MediaWiki 1.20.3 (r264)
PHP 5.3.3 (apache2handler)
MySQL 5.1.67

I was trying to get Pages under a Subcategory to display in a Categories view. I tried the following in LocalSettings.php:

$wgCategoryTreeCategoryPageOptions['mode'] = CT_MODE_ALL;
$wgCategoryTreeSpecialPageOptions['mode'] = CT_MODE_ALL;

and

 
$wgCategoryTreeCategoryPageOptions['mode'] = 'all';                                                                                       
$wgCategoryTreeSpecialPageOptions['mode'] = 'all';

but these had no effect.

It took going into extensions/CategoryTree/CategoryTree.php and changing NULL to CT_MODE_ALL:

$wgCategoryTreeDefaultOptions['mode'] = CT_MODE_ALL; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk
...
$wgCategoryTreeCategoryPageOptions['mode'] = CT_MODE_ALL; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk

for the behavior to change.

The documentation doesn't give any examples or make any assertions for $wgCategoryTreeCategoryPageOptions['mode'],

options to use on category pages

Has anyone else had any success with $wgCategoryTreeCategoryPageOptions['mode'] in LocalSettings.php?

Zacharysyoung (talk)22:31, 10 January 2014

Are you adding after require_once("{$IP}/extensions/CategoryTree/CategoryTree.php");?

Ancap (talk)10:36, 21 April 2014
 

"depth" parameter not working with pages

Hello, I have only a small hierarchy and I would like that the categorytree is initially fully expanded including pages and possibly subpages. Because of this I use the "depth" parameter.

Here an example of the following hierarchy: main_category->programming_category->ada_page
main_category->programming_category->c_page
<categorytree hideroot="on" mode="pages" depth="5">main_category</categorytree>

But the cateory tree only initially shows the categories, i.e. "programming_category" The pages are not shown initially. But if I manually click on the "+" left to "programming_category" then the pages are shown.

What do I have to do to initially expand "pages/subpages"? Why is the depth parameter only relating to categories and not to pages?

I'm using a 1.19 mediawiki and the latest stable version of the categorytree extension.

Thank you.

Best regards,
Dirk

Dirk 80 (talk)09:34, 17 December 2012

+1. A configuration setting that allows you to collapse/expand subpages would be very useful!

Cavila (MW 1.19.2, MySQL 5.1.66, Php 5.3.3-7, SMW 1.8, SF 1.5.2}11:45, 3 June 2013
 

Hi,

Did you get this working?

202.67.4.11307:10, 6 December 2013
 

Set $wgCategoryTreeMaxDepth[ CT_MODE_PAGES ] = 5; in your LocalSettings.php

LFS (talk)02:18, 24 March 2014
 

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

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.

Satyamcompany (talk)21:30, 25 April 2013

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

14.140.124.6913:18, 17 December 2013

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

Cornucopia (talk)11:48, 20 February 2014

Hi,

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

5.2.127.1015:04, 24 February 2014

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

Cornucopia (talk)15:48, 24 February 2014

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

Cornucopia (talk)19:37, 25 February 2014
 
 
 
 
 

memorize opened in tree categories

It became necessary to store(or memorize?) opened in tree categories and after move to another page we should open those categories. Other words - we are opening several categories in the tree, then we click several times at various articles and we should see the tree in the same form (those several categories should be still opened).

What the easiest way to do it? Big thx for help!



PS: sorry for my pure english

217.28.218.12212:22, 23 May 2012

categorytree is always dynamic, I don't think that's possible.

Nemo18:39, 28 September 2012

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

Cornucopia (talk)08:37, 21 February 2014
 
 

initial expanded categorytree tags

Until last year the categorytree-tag was initially expanded when I used wikitext like this: <categorytree mode=pages showcount="on" >Category:Tag_extensions</categorytree> . (=>

Tag extensions(573 P)

)

Since January, the tags are displayed collapsed. But I want to show the expanded version.

Boshomi (talk)13:43, 11 January 2014

The new default to collapsed didn't satisfact my needs either. Any workaround available?

Lugusto (talk)02:34, 14 February 2014
 

categorytree not working in templates

I am trying to use category tree in a template and it's not working. If I use this version:

I get nothing (nothing is displayed on the page).

If I use this version:

Category Extension talk:CategoryTree/categorytree not working in templates not found

I get an italic line that says "Category XXXX not found".

If, however, I hard code the subpage name in the template (which defeats the purpose of the template) it works fine.

Here's the template in its entirety:

Category Extension talk:CategoryTree/categorytree not working in templates not found
66.178.130.20915:52, 25 January 2014

Sorry, it won't let me edit the above to fix the formatting issues.

66.178.130.20916:38, 25 January 2014

Interesting.... Apparently restarting apache is not enough to get categories to show up in a template. My LAMP server reboots early Sunday AM (this morning) and now the categories show up correctly. I have no idea why a reboot might be necessary, but before the reboot I'd get a "Category XXX not found" and now I get the category tree.

66.178.130.20916:16, 26 January 2014
 
 

setting mode does not work as desired

Hi, Mediawiki 1.19.9

I set up mode = pages and mode = all. But the category tree does not display the pages, but only displays the categories within the tree. Is there a way for the category tree to display the pages within the category?

Thanks Arnab

81.247.85.6219:41, 7 January 2014

Broken?[edit | edit source]

Hi, the categorytree in idwp is broken.

Category Pengguna yang diminta untuk diblok not found

used to work in id:WP:PPP#Pemblokiran and elsewhere, but now it didn't. I will crossposting a bug, if no one has reported it yet.

Bennylin (talk)08:53, 22 January 2014
 

Javascript error loading the tree in the sidebar

I have the extension working, and have now the config:

$wgUseAjax = true;
require_once( "$IP/extensions/CategoryTree/CategoryTree.php" );
$wgCategoryTreeDynamicTag = true;
$wgCategoryTreeSidebarRoot = '[my top level category]';
$wgCategoryTreeForceHeaders = true;

When loaded the in-page tree loads fine, the categories heading appears for the portlet, but nothing else. The javascript console reports that categoryTreeloadChildren is undefined.

Using 1.21 on Chrome

any help appreciated

Hoggle42 (talk)15:29, 19 November 2013

I have submitted a bug report to MediaWiki.

Bamyers99 (talk)00:16, 11 January 2014
 

Unable to maintain tree state, collapses every time

Edited by another user.
Last edit: 17:06, 8 January 2014

Hi Daniel,

This extension is very useful for maintaining tree structure for categories and iam using it in sidebar. But i have issue with maintaining tree state in multiple clicks or on clicking front/back buttons of browser, as of now it is collapsing every time to its initial state. Is it possible to maintain its state like the navigation in sidebar for SEARCH, TOOLBOX of mediawiki, please help...

Thanks.

14.140.124.6906:58, 8 January 2014

Fatal error CategoryTreePage.php

I just upgraded to mediawiki 1.19.9 . The CategoryTree extension for 1.19 gives the following error Fatal error: Call to undefined method SpecialPage::specialpage() CategoryTreePage.php on line 27

Any idea how to fix this one? Does it work with 1.19.9 or should I have to downgrade? If so, which version of mediawiki does it perfectly work with?

81.247.89.21612:44, 15 November 2013

okay, sorry, I had loads of versions of CategoryTree and this one was a wrong version. The 1.19 version of CategoryTree works perfectly goood.

81.247.89.21612:05, 16 November 2013
 

how to make multi level

Edited by another user.
Last edit: 14:04, 14 November 2013

Hello My idea is to bring up like this Introduction->Introduction1

                              ->Introduction1.1
                              ->Introduction1.2
                  ->Introduction2

I have created a category Introduction,i have also created a category Introduction1 and Introduction2 ,and created 2 pages Introduction 1.1. and introduction1.2 Inside introduction 1 and Introduction 2 I have written [[Category:Introduction]] and inside Introduction1.1 and Introduction1.2 i have written [[Category:Introduction1]] there is page called Myhome where i have coded like this <categorytree mode=pages>Introduction</categorytree> but only Introduction1 and 2 are listing, the subcategories Introduction1.1 and Introduction1.2 of Introduction1 are not getting listed.


Stuck here for a while, hope i will get a solution

Fazeela Abu Zohra (talk)11:35, 4 November 2013

no categories!

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.

68.189.49.1200:14, 3 December 2012

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 (talk)21:49, 3 December 2012
 

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)

Axanon (talk)22:45, 3 December 2012

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

81.92.239.520:03, 6 December 2012
 

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.

Banaticus (talk)20:03, 6 December 2012

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

81.92.239.520:20, 6 December 2012

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

2600:1010:B11D:5C3B:9856:A19B:66B6:DB1409:10, 10 December 2012
 
 

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 ?

Jm.lefevre (talk)13:34, 11 December 2012

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

However:

  • An old version I used with 1.18.x version does work :) But I can't figure out the version number..
Daniel K. Schneider (talk)14:55, 11 December 2012

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

Jm.lefevre (talk)19:06, 11 December 2012
 

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

Tiggerjay (talk)00:37, 12 December 2012

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

Jm.lefevre (talk)04:26, 12 December 2012
 
Edited by 2 users.
Last edit: 10:50, 8 July 2013

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;
require_once("{$IP}/extensions/CategoryTree/CategoryTree.php");
$wgCategoryTreeSidebarRoot = "Contents";
$wgCategoryTreeForceHeaders = true;
$wgCategoryTreeSidebarOptions['mode']=CT_MODE_CATEGORIES;
$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 !!

http://edutechwiki.unige.ch/mediawiki/index.php?title=Semantic_Form_demo_page&action=formedit

Daniel K. Schneider (talk)11:44, 4 July 2013

Hi,

I tried your solution which still doesn't work for me. I do not see "categoryTreeLoadChildren is not defined" anymore, but my

Edga (talk)09:52, 15 October 2013
 
 
 
 
 

Suppress links to categories, only link to pages.

On Wikivoyage we are using category trees to display related travel topic pages in articles. However, we would like to only display links to pages, we don't want the readers to link to sub-categories. We use mode=pages, but that only affects the bottom level, all the subcategory titles are displayed as links to the category namespace pages.

  • Is there a way to display the category names in the tree without links to the categories?
  • Ideally clicking on the category name would have the same effect as [+] or [-], but that would be a bonus.
Pbsouthwood (talk)08:40, 10 October 2013

Your suggestion is almost identical to the suggestion I made last May. I 'dragged my post to a new location' (using the menu item under the 'More' menu) to place it directly under your post, to give both postings more emphasis.

Dennis J au (talk)03:09, 18 October 2013

How long should one expect to wait for a response here?

Pbsouthwood (talk)14:34, 19 October 2013

From one minute to one decade; it's the WikiNow.

Nemo07:37, 20 October 2013
 
 
 

How do I filter pages?

I want to list all the pages in Category:Foo but only pages that are both in Category:Foo and Category:Bar. And vice-versa too, that is list all pages in Category:Foo that aren't in Category:Bar.

88.104.110.23816:18, 5 October 2013

This page... Extension:DynamicPageList list 2 extensions that do the sorts of things you are looking for, one extension is more basic and simple than the other. Extension:Semantic_MediaWiki adds more features again, but adds even more complexity.

Dennis J au (talk)03:38, 10 October 2013

Thanks! I'll give this a try, looks very promising!

194.231.38.13210:03, 16 October 2013
 
 

Suggestion: CategoryTree enhancement for touch screens

Touch Problem:[edit | edit source]

On tablet touch devices I do not have the fine finger control necessary to 'touch' activate the '+' and '-' signs to show or reveal the items contained by a category. I usually end up touching the category name itself, which takes me away from the page I'm on, to the category page. This is not what I want to happen. What I'm interested in is to 'show' items in the category while staying on my current page, and then 'touch' linking to one of the pages in the category, not to the category page itself.

Suggestion:[edit | edit source]

Make the category names themselves, in the hierarchical tree, 'link' to showing beneath them the list of items in the category, rather than taking users off to a separate page devoted to that category.

This behaviour could be controlled by a parameter, users could set it to do things the way the extension currently works, or to do things the way I am suggesting here, i.e. to have clicking or finger tapping on category names showing the items under that category while keeping the user on the page they were already viewing.

Dennis J au (talk)13:09, 7 May 2013

Is it possible to make the hyperlink black and old like normal if it is listed?

Like this: Extension_talk:CategoryTree

88.104.100.7422:05, 9 October 2013

sort in reverse order?

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

DavidBiesack (talk)19:02, 7 November 2012

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

Cornucopia (talk)10:53, 8 November 2012
 

DynamicPageList provides the ability to sort in descending order.

DavidBiesack (talk)13:06, 8 October 2013
 

Combine categories by logical operators?

This might be in fact an enhancement request...

Is it possible to show one tree of pages which below to category a and b only?

Use case:
Our wiki contains product information. So every article belonging to product gets the product name as category.
When an article is a FAQ, it gets the FAQ category as well (now we can see e.g. all FAQs regardless of the product).
Goal would now be to get a FAQ list for a certain product as well without needing to create another category.

Thanks for every input!
backarc

194.231.38.13208:38, 30 August 2013

A better solution would be Extension:Semantic MediaWiki. Among other things, it allows you to create a list of pages that belong to both categories.

Cavila (MW 1.19.7, MySQL 5.1.66, Php 5.3.3-7, SMW 1.8, SF 1.5.2}10:46, 2 October 2013
 

Simple feature request

With "mode" set to "pages", there is a limit to the number of pages that are listed. That's perfectly fine by me, but what may confuse site visitors is that there's no indication that the list is curtailed. Something like "more results" with a link to the category would make things clear.

Cavila (MW 1.19.7, MySQL 5.1.66, Php 5.3.3-7, SMW 1.8, SF 1.5.2}10:39, 2 October 2013

CategoryTree not honoring DISPLAYTITLE:xxx

I am using to specify the titles of my pages. The extension shows the canonical name, not the displaytitle name. Is this by design or can it be fixed?

216.16.230.21018:49, 30 September 2013

The display title is never used outside the page itself, see in particular bugzilla:29975.

Nemo21:58, 1 October 2013
 
First page
First page
Previous page
Previous page
Last page
Last page