Extension talk:CategoryTree/LQT Archive 1

Sort Order
It would be nice to add an option to sort articles by first letter in article name, or to bypass sorting by surname in articles about people. --Sasa Stefanovic 15:49, 1 September 2006 (UTC)


 * "sorting by surname" is actually sorting by the sort key that is explicitely provided when the page is placed in the category. That's what category listings are sorted by. I'll think about adding sort options for the &lt;category&gt; tag and the special page - the view on the category pages will probably stay as it is. -- Duesentrieb 21:35, 1 September 2006 (UTC)
 * Yes, you know what i mean. And, when will be that option included ? --Sasa Stefanovic 21:54, 3 September 2006 (UTC)
 * Some time. Including the option isn't hard, but getting it right with caching is. -- Duesentrieb 23:27, 3 September 2006 (UTC)

After installing this excellent extension this was actually the first thing I wanted to be improved. I see it's already worked on it.

--Reinhard Brandstädter 08:45, 1 December 2006 (UTC)


 * I started using CategoryTree yesterday and I love it... But, there's one thing that I try to accomplish... If I have a category with two subcategories and three articles... Can I somehow disable the fact that the subcategories are sorted at the top?... I would rather have both the subcategories and articles sorted togheter...

/Jesper

Sort Order Case Insensitiv
Would it be possible to sort categories case insensitiv? e.g.

SAP Batch SAP BW

Today it is first SAP BW, which is not so nice. --GunterS 18:25, 1 March 2007 (UTC)

CategoryTree: Finnish translation
Hi, Duesentrieb. Kooma translated the new MediaWiki messages in Finnish Wikipedia and I made a php file from them. Should I paste this file to User:Duesentrieb/CategoryTree-fi, so that translations would be included into MediaWiki? --Hartz 13:49, 1 September 2006 (UTC) copied from my talk page -- 17:59, 1 September 2006 (UTC)


 * Cool! Hm, the language files under User:Duesentrieb/CategoryTree-xx are for the external tool, that's a bit different... please look at the i18n files in the repository and make a patch/file from that. -- Duesentrieb 17:58, 1 September 2006 (UTC)

Suggestions for CategoryTree
First, congratulations for your integration into MediaWiki of CategoryTree, it's very useful and funny :-) ! In the french Village Pump, somebody has proposed to place an option in the preferences to choose between the alphabetical list and the tree. Else I request a new message to differentiate the message nothing found when no subcategory is founded or no parent category is founded, so we could write no parent category founded and no subcategory founded. I ask this here but perhaps it would be in a better place on bugzilla. Best Regards and Congratulations :) ~ Seb35 16:52, 1 September 2006 (UTC) copied from my talk page -- 17:59, 1 September 2006 (UTC)


 * a new user option would be nice i guess, but afaik there's no clean way for extensions to put something into on preferences page. Maybe the selection could just "stick" once a user has made it? I'll think of something, not sure what yet.
 * An extra message for the parent categories also needs at least a third message for "no subcategory or page", in case pages are included in the tree. On the other hand, parent categories are shown only on the special page - which is kind of redundant anyway. Maybe i'll turn it off in the future.
 * I'll look into getting CategoryTree set up as a "product" in Bugzilla. -- Duesentrieb 18:09, 1 September 2006 (UTC)
 * Thanks for your quick answer. For the option (we haven't see that it use cookies), someones purposed that because they don't like the change, the main reason is that it make a big column for some category (as your next note says), and a second small reason is that it don't work on their config (JavaScript?). Else fr:Utilisateur:Lgd who work in accessibility for Wikipedia says interesting things about this, I asked him to tell here his point of view. ~ Seb35 07:49, 2 September 2006 (UTC)

I have written a "unified" category view which looks just like the traditional three column display but lets you expand each subcategory as a tree. It's enabled here on meta now, see Category:MediaWiki for example. I guess that will become the preferred mode in the future. -- Duesentrieb 12:45, 2 September 2006 (UTC)

Is there anywhere that can be downloaded? --Paul Barkley 15:16, 25 September 2006 (UTC)

General ToDo

 * Note to self: make a "unified" view: "traditional" three column view, but with "expandable" subcategory entries. -- Duesentrieb 21:36, 1 September 2006 (UTC)
 * "no subcategories" vs. "no pages" vs. "nothing"
 * Make top level subcats bold?
 * Hide [+] toggels if no JS?
 * use global nojs switch instead of notree?
 * add an attribute to categories without children, when loaded.
 * Make "root only" mode for tag.

(short reminders for myself -- Duesentrieb 11:55, 4 September 2006 (UTC))

Lynx
Hi. Wir hatten ja heute schonmal im Chat über die +-Zeichen vor Kategoriebäumen gesprochen und die Möglichkeit, diese auszublenden. Ich hab mir das ganze jetzt mal im de:Lynx (Browser) angeschaut und muss feststellen, daß das da doch recht unschön und verwirrend ist, wenn ein Link angezeigt wird, der aber generisch eine Fehlermeldung auswirft: de:Bild:Cattree in lynx.jpg. Ich grüble schon die ganze Zeit, wie man es vielleicht doch verstecken kann. --Gnu1742 19:31, 2. Sep 2006 (CEST) Ich musste mit schmunzeln feststellen, daß Lynx im Fehlerfall 'Obacht' schreit;-))

Sidebar
Can this extension be used in the sidebar? There's similar work going on with the DPL2 extension here: http://meta.wikimedia.org/wiki/Talk:DynamicPageList2#Add_Format_Option_for_display_in_sidebar

20:49, 2 September 2006 (UTC)


 * The external tool (see User:Duesentrieb/CategoryTree) can. Maybe I'll add this to the MediaWiki extension - but sadly, different browsers expect slightly different things in the sidebar (especially ragarding the target-attribute of links). This makes it a bit tricky with caching and all that. -- Duesentrieb 21:53, 3 September 2006 (UTC)

Some discussion at en-Wikipedia
See Wikipedia:Wikipedia:Village pump (technical). In particular, the comment here: "One potential problem is that people who click on the "+" sign and get the "nothing found" result, might think that is the end of the road: no articles there. Of course, it really means that there are just no subcategories. But will new users realise they need to click on the category link to see the articles inside the category?", and the comment by DuncanHill asking for the ability to chose which display he can use. Some further comments, but not much discussion yet, at Wikipedia:Wikipedia talk:Categorization. It would be nice if someone from meta could come over to the en-Wikipedia, as not everyone there will be aware of the discussions at Meta. Thanks. - Carcharoth 11:25, 3 September 2006 (UTC)
 * Update: the "nothing found" label has now changed to "no subcategories" (on en-Wikipedia at least). Thanks for this. On Meta the label still says "nothing found". Haven't checked the other WikiMedia projects. Carcharoth 20:52, 3 September 2006 (UTC)
 * Update: Meta "nothing found" label changed to "no subcategories" (note - I am just recording what I see happen. I'm not implementing any of this - I don't know my Mediawiki from my Wikimedia! :-)) Carcharoth 12:22, 6 September 2006 (UTC)

Fatal error?
Any idea what is wrong when I get this error-message?

Fatal error: Undefined class name 'xml' in ../wiki/extensions/CategoryTree/CategoryTreeFunctions.php on line 54


 * Which wiki? your own? Hm, what version of MediaWiki are you using? CategoryTree is currently for 1.8alpha only. I don't think it'll run with 1.7, as I had to change some bits in the code code to make it work. -- Duesentrieb 17:29, 4 September 2006 (UTC)

Ah, that explains a lot. Thanx.

title=Special:CategoryTree&
I have this extension running on my wiki, but when you are looking at a category tree and change any of the settings then press the button, or enter, to have them take effect it neglects to inculde the title=Special:CategoryTree& part of the url. Does anyone know where would I add that? I've been looking around a little and have yet to find it. For instance, instead of showing
 * /index.php?title=Special:CategoryTree&target=Main&mode=pages&dotree=Show+Tree

Clicking the button shows
 * /index.php?target=Main&mode=pages&dotree=Show+Tree

--Paul Barkley 16:45, 21 September 2006 (UTC)

Quick fix (horrible hack!)

 * Edit CategoryTreePage.php
 * Find the following line
 * After this line, add the following line

-- Ricmelia 09:18, 20 October 2006 (UTC)


 * Thanks, hack or not it worked perfectly. --Paul Barkley 20:16, 24 October 2006 (UTC)

Blank Page when enabled.
I am running Mediawiki 1.8.1 and when I enable this extension My site goes blank. I turned off all other extensions to test if it was some type of incompatibility, but that didn't work either.


 * Check if after require_once("extensions/CategoryTree/CategoryTree.php")  have a ; in localsettings.php like bellow:
 * require_once("extensions/CategoryTree/CategoryTree.php");
 * --kostas1972 [[Image:gre.gif | kostas1972]] 17:22, 15 October 2006 (UTC)


 * Yes the ; is there.
 * This is my configuration:
 * MediaWiki: 1.8.1
 * PHP: 5.0.4 (apache2handler)
 * MySQL: 4.1.20


 * _________________
 * so check if this line or any other line similar (for enableing extensions)
 * is placed at the bottom of localsettings.php for example if extension :::whoisonline be placed on top or near top everything goes white ... when placed at bottom everything its ok.This happen because the extensions not loading at the right time and things mixed up, most common is to place them at bottom exept one or two of them.
 * TRY change this orders .I cant find any other explanation...if not working :::try redownload categorytree.
 * --kostas1972 [[Image:gre.gif | kostas1972]] 22:21, 16 October 2006 (UTC)


 * _________________
 * OK, I got it working but I cannot collapse the tree. i get a javascript error: categoryTreeCollapseNode is not defined.


 * _________________
 * the script working fine if you download from svn!i had notice that the tgz. file is full of errors try redownload the script delete all files and copy the newfiles in extensions/CategoryTree/ it sould work with 1.8.2 and 1.8.1
 * i have the same php and apache versions on fedora core4 now working excellent ... my problems stoped... see bellow my other post for details about svn and packed tgz folder.
 * --kostas1972 [[Image:gre.gif | kostas1972]] 17:52, 17 October 2006 (UTC)


 * _________________
 * Success! It works after I download your files.

bad target for sajax_do_call: not a function or object: undefined
when press + to open subcategories i get this error any idea? please help. bad target for sajax_do_call: not a function or object: undefined

--kostas1972 17:53, 17 October 2006 (UTC)

_______________ PROBLEM SOLVED : downloaded again the files from SVN this time and worked the link inside wediawiki-extensions/categorytree-extension provides this link :(download area with bundled version->notworking) provides a zip file with older(or broken) files ... someone must check and fix this. Download a working version from svn here: WORKING FILES FROM SVN repository I also made a Greek (el) translation for CategoryTree-extension available here  untill User Duesentrieb post it in svn and a (el) translation CategoryTree-external tool el be carefull this is the external tool not extension translation

--kostas1972 17:53, 17 October 2006 (UTC)
 * ______________________
 * I was getting this problem too. Then I upgraded to 1.8.1 and now the extension doesnt show at all.


 * you mast update your localsettings.php ... put somewere at the end the following:
 * $wgUseAjax = true;
 * recuire_once('extensions/CategoryTree/CategoryTree.php');
 * --kostas1972 [[Image:gre.gif | kostas1972|13px]] 17:53, 17 October 2006 (UTC)


 * ______________________

I have downloaded the files from SVN and am still getting target for sajax_do_call: not a function or object: undefined

I would really like to use this extension - how do I get it to work???--Magick 22:35, 18 October 2006 (UTC)
 * __________
 * What version is your wiki? 1.8.1 and 1.8.2 is supported and none bellow.
 * Have you carefully replace all files inside extensions/Categorytree/ with the new files?
 * Also make sure that you cleaned your browser's cache and reload page to see results and that all extension entries in localsettings.php placed at the bottom jast before ?>

kostas1972 13:57, 19 October 2006 (UTC)


 * __________
 * Worked for me after clearing cashe. Great extension. Thank you.

All Pages options for Subcategory listing
Is there a way to enable the all pages option on category pages for subcategory children? I.E I have a number of documents seperated by month, and a category for each month. Each month category, in turn, is a subcategory of the year category, which is a subcategory of the main 'parent' directory.

When pressing the [+] beside the first child (the year) a reader will see the month, but when pressing the [+] next to month, the reader is shown "no subcategories" it would be benificial, at least in my case, to be able to display the contents of each month on the 'parent' category page. I know this can be done when using the  that is the format to display articles and subcategories in a categorytee....I suggested the redirection of category to a newpage as this will not display twice'''  the cats and sub cats in a category page..also can put the tag in any page to avoid redirections and guide users there.
 * The other extensions i mentioned is not exactly what you want but can enanche your articles listings...
 * Hope that this helped you...have a nice day.
 * kostas1972 [[Image:gre.gif | kostas1972|13px]] 17:19, 20 October 2006 (UTC)

My hack

 * 1) Locate where CT_MODE_CATEGORIES is default parameter of a function, e.g. function efCategoryTreeAjaxWrapper( $category, $mode = CT_MODE_CATEGORIES ) {
 * 2) Replace by function efCategoryTreeAjaxWrapper( $category, $mode = CT_MODE_CATEGORIES ) {
 * 3) In efCategoryTreeParserHook function, replace else { $mode = CT_MODE_CATEGORIES; } by else { $mode = CT_MODE_PAGES/*CT_MODE_CATEGORIES*/; }

--Iubito 17:08, 19 November 2006 (UTC)


 * Not sure if anyone is still looking for a way to have the ALL or PAGES mode by default on the dynamically created "Subcategories" pages. The above hack only changed the default mode of the categorytree tag to PAGES, but it did not change anything in the "Subcategories" pages. I think I've found a way to do it though. I'm in the middle of testing this to make sure nothing else is broken. Please let me know if anyone is still interested in this. Thanks

-- alex 10:48, 09 March 2007

Collapsed by default?
When using the tag method, is there a way to show the tree collapsed by default?


 * I agree. This would be a very good thing to have.  The Special Page has it about right.  It has the topmost level expanded, but all the rest aren't.  Anybody know how to best do this? --N0ctrnl 21:40, 14 November 2006 (UTC)

An onlyroot option has been added in 20385. @N0ctrnl: expanding one level is the default behavior. -- Duesentrieb ⇌ 11:43, 13 March 2007 (UTC)

Two wishes
I would like to have two features:
 * Remove the prefix "Category:" in tree. This is an easy one, isn't it?
 * Is it possible to remove the + before category with no subcategories/pages?

If these changes won't make it in your repository, can you tell me how to do it?

Thanks a lot, akw


 * Hi - the "Category:" prefix should be hidden if you specified that you want only categories. At least I vaguely recall writing it that way :) If the tree also shows normal pages, it would be confusing to omit the Category:-prefix.
 * It is not pssible to remove the + beforehand - only after the "subtree" has been loaded (that would be a bit tricky, but doable - look into CategoryTree.js). To know in advance if there are pages/subcategories in a category means an additional database query for each category shown (i.e. n calls instead of 1 call, for every time you load a category view) . That would be too slow.
 * Regards -- Duesentrieb 14:18, 24 October 2006 (UTC)


 * I don't think it is confusing to omit the category prefix everywhere, because every category has a [+] or [-] prefix. So it is always easy to distinguish a category from a normal page. JePe 10:49, 29 October 2006 (UTC)


 * I also wanted to remove the "Category:" namespace prefix from the "all" listing. This can be done by changing lines 289 to 291 (orginal lines shown below):

if ( $mode == CT_MODE_CATEGORIES ) $label = htmlspecialchars( $title->getText ); else $label = htmlspecialchars( $title->getPrefixedText );
 * 1) when showing only categories, omit namespace in label
 * By removing the conditional and always calling getText instead of getPrefixedText you can always get the text without the namespace prefix. So the short of it is you end up with the following code replacing the above code with the following code:

$label = htmlspecialchars( $title->getText );
 * 1) when showing only categories, omit namespace in label
 * 2) Roy's Hack: Always hide the category namespace label
 * --w:User:Imjustmatthew

As of Revision 17863, it is now possible to suppress the namespace prefix using the option $wgCategoryTreeOmitNamespace = true; See 8011. -- Duesentrieb 10:09, 23 November 2006 (UTC)

CategoryTree in the sidebar
I have made some css to load CategoryTree in the sidebar of Firefox. This is possible since every page has it's own class. The css strips everything from Special:CategoryTree except for the tree itself. It must be placed in User:XXX/monobook.css. For other languages than English the text "Special" must be changed to the right namespace-name.

body.page-Special_CategoryTree .firstHeading, body.page-Special_CategoryTree #jump-to-nav, body.page-Special_CategoryTree p, body.page-Special_CategoryTree form, body.page-Special_CategoryTree .CategoryTreeParents, body.page-Special_CategoryTree .portlet, body.page-Special_CategoryTree #footer, body.page-Special_CategoryTree #siteSub { display:none !important; } body.page-Special_CategoryTree { background:white; } body.page-Special_CategoryTree #content { margin:0; padding:0; border:none; background:white; } body.page-Special_CategoryTree .CategoryTreeItem { white-space:nowrap; }

Now you can load the following page and make a bookmark which loads it in the sidebar: http://en.wikipedia.org/wiki/Special:CategoryTree?target=Categories&mode=all JePe 20:34, 28 October 2006 (UTC)

CategoryTree nur mit Tag benutzen
Hi Düsentrieb

Wie ist es möglich, CategoryTree nur mit dem )

Ah, OK - youwant to tell it to automatically expand down to a specific node. That'S tricky - first of all, I would have to determine the full path from the "root" to the "current child" (which takes several DB queries). Then I would have to immediately expand down to that child (which again takes several DB queries). In your example, this is not such a big problem, because B is directly under A, and there are only three nodes total. But for a general solution, this could become extremely expensive if used incorrectly.

I don't see a way to do this cleanly, sorry. -- Duesentrieb 10:29, 23 November 2006 (UTC)


 * Yes, there has to be a recursive question for the parent. This procedure can generate some JavaScript code (in my example . For that I just see a little cost (just the number of parents). Perhaps I can gain some skill in PHP to do it by myself but do not bet on it ;)
 * --141.7.15.126 10:09, 28 November 2006 (UTC)

CategoryTree.css and CategoryTree.js wrong MIME-Type
Hi,

We are using mediawiki 1.8.2 with Apache 2.0.54 and PHP 5.0.4, after installing CategoryTree and calling the Page, we got the message:

Error: The stylesheet http://wiki.MyDomain.net/extensions/CategoryTree/CategoryTree.css was not loaded because its MIME type, "text/html", is not "text/css".

and

Error: syntax error Source File: http://wiki.MyDomain.net/extensions/CategoryTree/CategoryTree.js Line: 1 Source Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Apparently the $wgScriptPath seems not to work (in the LocalSettings.php is $wgScriptPath = ""; because the wiki is installed in the root). Any suggestion?


 * I'm pretty sure this problem is unrelated to the extension itself. The files are served directly by apache, not through mediawiki - so, if you see the wrong mime type, apache is giving the wrong mime type. Please try to enter the url directly into your browser and report what you see.


 * My guess is that apache is not serving the css and js files at all, but an (html) error page (probably a 404 or 500). I suspect this is due to rewrite rules you are using to have the wiki in the server's document root - you need exceptions to the rules for special directories, like /skins; For the CategoryTree extension to work, you need to make /extensions such an exception too. -- Duesentrieb 13:34, 22 November 2006 (UTC)


 * In short: You win! :) I put the 'extensions' into the RewriteRule an now it works as expected. Thank You!

default open depth
Would it be possible to specify how deeply the tree was initially open? It would be useful if the tree for a category coulb be made to list all of its subcategories and their subcategories; that is one level farther than is currently shown, as if every + was clicked. -Sanbeg 00:25, 5 December 2006 (UTC)

Problem with Firefox
I have a fresh installation MW 1.9.2 with categoryTree. It works fine with IE6.

Using Firefox (1.5x and 2.0.0.2) I can open the +, it displays load (laden) and then nothing.

Firfox error console reports: "Fehler: uncaught exception: Die Erlaubnis für den Aufruf der Methode XMLHttpRequest.open wurde verweigert" meaning "Error: uncaught exception: The permission to call the method XMLHttpRequest.open was not granted".

I do not use a short url. Any ideas? --GunterS 17:26, 26 February 2007 (UTC)


 * Some security policy seems to prevent the ajax call. No idea what it could be exactly. Do you have the same problem on other wikis, like wikipedia? Perhaps when using it with "ugly" URLs? -- Duesentrieb ⇌ 00:34, 27 February 2007 (UTC)

Working on category pages but not when included
After installing the extension it works on the category pages and on the special page but when I try to manually put it on a page clicking the (+) doesn't do anything. I'm using the following code:

I also tried:

Please check your JS error log and report what it sais. Also look at the HTML source and see if CategoryTree.js is included properly. This might be a problem with the skin. -- Duesentrieb ⇌ 00:35, 27 February 2007 (UTC)

Good hint, looking at the HTML code of a page and comparing it with the special page I noticed the following entry missing:

  var categoryTreeCollapseMsg = "collapse"; var categoryTreeExpandMsg = "expand"; var categoryTreeLoadMsg = "load"; var categoryTreeLoadingMsg = "loading"; var categoryTreeNothingFoundMsg = "nothing found"; var categoryTreeNoSubcategoriesMsg = "no subcategories"; var categoryTreeNoPagesMsg = "no pages or subcategories";

Actually I use the default skin (Monobook) and also tried a couple of other skins - doesn't work on any of them. Any pointers where this JS code should be actually inserted?


 * It seems like efCategoryTreeParserOutput is not being called when the page is rendered. efCategoryTreeParserOutput implements the OutputPageParserOutput hook - maybe another extension is interfereing with that hook (for example by not returning true from its hook function). Try including the CategoryTree extension before any other extension. And check that OutputPage.php contains the line wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) ); - if not, your installation is somehow broken, or quite old. What version of MediaWiki are you using? The last possibility I see would be that something is messing with the ParserOutput object, and the mCategoryTreeTag flag is lost. -- Duesentrieb ⇌ 20:44, 27 February 2007 (UTC)
 * Thanks! It was another extension that messed with this hook. After I disabled it the category tree works perfectly fine...

Show only root initially
I'd really like to have an option that makes the categorytree folded when first called. Ger Apeldoorn.
 * done in 20385 -- Duesentrieb ⇌ 11:41, 13 March 2007 (UTC)

Location of code that handles displaying the titles of the children?
Was wondering if anyone knew where in the categorytreefunctions.php the part where it handles the names of the children when you expand the tree? Reason is so I can edit the titles so they only show the last part of each title instead of the entire title, since the titles I use are seperated by colons and can get very long. It's not the $label area in renderNode section as it only handles the nodes being displayed first. Vince


 * It is $label in the renderNode function: ajax calls renderChildren, which calls renderNode. If you are not seeing the effects of your changes, there is probably a caching issue. Especially, look at $wgCategoryTreeHTTPCache and the calls to checkLastModified and loadFromMemcached in the ajax function. -- Duesentrieb ⇌ 11:08, 13 March 2007 (UTC)


 * Ah thank you for the quick response. You were right, it was just my browser cache showing what the old pages looked like in the tree. Vince