Extension talk:CategoryTree/LQT Archive 1

Building a test category hierarchy
For all those people that are new to wiki category concept and CategoryTree, like me, here is a *nix command line script to build a test category hierarchy for you (tested under Bash):

ctid=0
 * 1) category id

echo "" > "Category:Test P$((ctid+1))".txt php maintenance/importTextFile.php !$

ctid=$((ctid+1))

Basically, you initial the category id variable and then, import the generated file into wiki, increase the category id variable, then loop the procedure to whatever depth you want.

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)


 * Better yet, if no subcategories exist, hide the "[+]" control. Eep² 13:35, 20 July 2007 (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.
Q1a: 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.


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

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


 * A1b: so check if this line or any other line similar (for enabling 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 except 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)

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


 * A2: 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 should 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 stooped... see bellow my other post for details about svn and packed tgz folder.
 * --kostas1972 [[Image:gre.gif | kostas1972]] 17:52, 17 October 2006 (UTC)

Q2b: '''Success! It works after I download your files.'''

--

Q3: Peter Blaise says: Me, too - a blank page. What did you do to resolve the initial blank page syndrome to get to the javascript error? After re-downloading from the raw, non-zip files, I managed to get: "mywikiname" has a problem Sorry! The site is experiencing technical difficulties. Try waiting a few minutes and reloading. (Can't access the database serer: Access denied for user 'wikiuser'@'localhost; (using password:YES) (localhost)

I had to go back to an earlier version of LocalSettings.php (I make and keep a copy before each change), and I cannot seem to install Extension:CategoryTree and have it work - I always get the blank screen syndrome. My resources: I have direct access to my Microsoft Windows XP Pro server, with: MediaWiki: 1.10.0 PHP: 5.2.2 (apache2handler) MySQL: 5.0.41-community-nt Extensions Special pages LastUserLogin (version 1.0.6) Displays the last time a user logged in Justin G. Cramer, Danila Ulyanov, Thomas Klein Parser hooks DynamicPageList2 (version 1.2.1) based on DynamicPageList, featuring many improvements IlyaHaykinson, Amgine,Unendlich, Cyril Dangerville,Algorithmix Subpage List 2 automaticaly creates a list of the subpages of a page Martin Schallnahs, Rob Church Extension functions wfLastUserLogin, wfUpdateUserTouched, wfDynamicPageList3, wfDynamicPageList2 and efSubpageList Parser extension tags ,, and Parser function hooks dpl, int, ns, urlencode, lcfirst, ucfirst, lc, uc, localurl, localurle, fullurl, fullurle, formatnum, grammar, plural, numberofpages, numberofusers, numberofarticles, numberoffiles, numberofadmins, numberofedits, language, padleft, padright, anchorencode, special and defaultsort

Hooks Hook name Subscribed by LanguageGetMagic wfDynamicPageList3_Magic LoadAllMessages wfDynamicPageListSPloadMessages visited from 10.113.9.106

Retrieved from "http://etc00322/ustdedwiki/index.php/Special:Version"

Thanks -- Peter Blaise peterblaise 17:58, 11 July 2007 (UTC)

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


 * Seems to be a problem with the pc-firewall. Accessing the wiki from a pc with a different configuration there is no problem. --GunterS 08:59, 31 March 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

Compatible with 1.9.3?
Is this extension compatible with 1.9.3? Just did a fresh install, loaded CategoryTree (the only extension), Special:Version shows it to be loading, but the inline function returns "Category foo not found" (foo being a real, present category) and using the form on Special:CategoryTree just kicks me out the main page.

The js wasn't being loaded into the head of the template (monobook) initially, but even after I manually inserted the js into the head of the template, the plugin does nothing.


 * MediaWiki: 1.9.3
 * PHP: 5.2.1 (cgi-fcgi)
 * MySQL: 5.0.24a-standard-log
 * CategoryTree r20410

TIA, -S


 * Since the extension has been running in Wikipedia continuously since the days of 1.8alpha, I'm pretty confident it's compatible with all versions since. I have also used it with 1.9 myself. I don't know why you are having problems, sorry. -- Duesentrieb ⇌ 14:09, 17 March 2007 (UTC)


 * Thanks for the quick reply. Do you have any pointer on where I should start troubleshooting this? I'm afraid my knowledge is a bit AJAX deficient. Are there any debug or verbose options that can be set?


 * the best checklist is probably this talk page. Look at the problems other users where having, and how they resolved them. You can set Manual:$wgDebugLogFile, but i'm not sure if that would help you. Well it might give a clue why Special:CategoryTree dosn't work. You can also increase error verbosity:

$wgShowExceptionDetails = true; $wgShowSQLErrors = true; error_reporting(E_ALL); ini_set("display_errors", 1);
 * HTH -- Duesentrieb ⇌ 01:01, 18 March 2007 (UTC)


 * Excellent, thanks for the direction. I'll report back if I find the cause/fix.

Leere span Einträge
Zwei kleine Verbesserungsvorschläge für CategoryTree

1. In der README steht noch statt
 * http://meta.wikimedia.org/wiki/CategoryTree_extension
 * http://www.mediawiki.org/wiki/Extension:CategoryTree

2. was wichtiger ist, wenn nicht nur Kategorien, sondern auch Seiten im Baumansicht angezeigt werden, kommt es zu leere Tags im HTML-Code. Um das umzugehen, habe ich eine kleine Änderung in CategoryTreeFunctions.php vorgenommen:

Ab Zeile 334

$s .= wfOpenElement( 'span', array( 'class' => 'CategoryTreeBullet' ) ); if ( $ns == NS_CATEGORY ) { $s .= '['. wfElement( 'a', $linkattr, $txt ). '] '; } else { $s .= ' '; } $s .= wfCloseElement( 'span' ); wenn man die span-Tags ins if verschiebt, werden die Seiten wieder W3C passend if ( $ns == NS_CATEGORY ) { $s .= wfOpenElement( 'span', array( 'class' => 'CategoryTreeBullet' ) ); $s .= '['. wfElement( 'a', $linkattr, $txt ). '] ';   $s .= wfCloseElement( 'span' ); } else { $s .= ' '; }

Desweiteren sollte die Versionsnummer in der README stehen, ich habe kA., ob ich die neuste hier habe ;-)

-- Miki11 14:02, 25 March 2007 (UTC)
 * fixed. -- Duesentrieb ⇌ 13:59, 30 March 2007 (UTC)

depth problem
having loaded the current 1.9.3 of MW, and download the bleeding edge of your extension, we are having problems getting the depth to start out displaying to level 5.

I am sure I have missed something in the setup but ??

You mention in the doc that the depth is dependant on the mode i believe but nowhere do I see that defined.

thanks --Dtsig 20:10, 12 April 2007 (UTC)

As stated in the documentation, it's defined by $wgCategoryTreeMaxDepth. I have added an example to Extension:CategoryTree, I hope it helps. -- Duesentrieb ⇌

Still missing the boat Thanks for that. Here are the settings ..

LocalSettings $wgUseAjax = true; require_once( 'extensions/CategoryTree/CategoryTree.php' ); $wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 5, CT_MODE_ALL => 5, CT_MODE_CATEGORIES => 5);

Tag in page

initially i get this ..

[?] WIKISANMAR.CATEGORIES [+] DOCUMENTATION [+] HOWTO [+] PROCESSES [+] PROJECT-IT-LAUNCH [+] PROJECT-IT-TECHNICAL [+] PROJECT-IT-TEST [+] PROJECT-IT-WORK [+] PROJECT-SCOPE

If expand project, project-it, project-it-functional I would think i would see the '872-Hal Environments' which is a page which is linked to category project-it-functional.

[?] WIKISANMAR.CATEGORIES [+] DOCUMENTATION [+] HOWTO [+] PROCESSES [–] PROJECT [–] PROJECT-IT [–] PROJECT-IT-FUNCTIONAL no subcategories [+] PROJECT-IT-LAUNCH [+] PROJECT-IT-TECHNICAL [+] PROJECT-IT-TEST [+] PROJECT-IT-WORK [+] PROJECT-SCOPE

Sorry if i am blundering this all up. I would think that 'all' would show pages and categories and that depth=5 would at least show to 5 indents. Have tried various nubmers but no matter what i change this to i don't get any changes. i just can't see where i have gone wrong --Dtsig 19:42, 18 April 2007 (UTC)


 * I'm not sure if this is actually your problem, but your syntax is broken:

&lt;categorytree mode="all"; depth=5; style="...">
 * is wrong. should be:

&lt;categorytree mode="all" depth="5" style="...">
 * try it... -- Duesentrieb ⇌ 21:18, 18 April 2007 (UTC)

You are the man .. thanks a lot --Dtsig 17:33, 19 April 2007 (UTC)

Error: categoryTreeExpandNode is not defined
Everytime I click on a + I get:

Error: categoryTreeExpandNode is not defined Source File: http://www.ibsurvival.com/wiki/index.php?title=Category:Subjects Line: 1

or

Error: categoryTreeExpandNode is not defined Source File: http://www.ibsurvival.com/wiki/index.php?title=Category:Biology Line: 1

So on and so forth (category varies)...

Any ideas? --Deus 21:35, 20 April 2007 (UTC)

see Clicking the [+] has no effect / gives JavaScript error and the section following that. -- Duesentrieb ⇌ 21:44, 20 April 2007 (UTC)

I looked at those and I'm afraid I don't really understand: Make sure your Webserver uses the correct mime types for .js and .css files Enter the URLs directly into the browser and see if it is serving the pages at all, and not some error page; especially --Deus 21:48, 20 April 2007 (UTC)


 * Looking at the HTML from your wiki, it seems like your custom skin doesn't output the head scripts. When using a monobook/skintemplate based skin, you'd get those from $this->html('headscripts'), otherwise you'll somehow fetch them from $wgOut->getScript. Those scripts have to go into the html head section; they are used by many extensions and some built-in functions too. -- Duesentrieb ⇌ 22:56, 20 April 2007 (UTC)


 * Ah I know what you are saying. I'll change that ASAP and let you know how it goes. Thanks.
 * It works! I just added $this->html('headscripts')</tt> to the skin and it seems to work fine. Thanks a million. Appreciate your help. :) --Deus 07:03, 21 April 2007 (UTC)

One last thing, is it possible to make mode="all" by default?
 * not without hacking the source. Have a look at efCategoryTreeParserHook if you want to do that. -- Duesentrieb ⇌ 11:41, 21 April 2007 (UTC)
 * Where exactly should I be looking? Thanks again for your help. --Deus 08:48, 22 April 2007 (UTC)
 * You should look for the place where the default mode is set if no "mode" argument is provided. If you can't find that in that function, you probably shouldn't touch the source... -- Duesentrieb ⇌ 11:06, 22 April 2007 (UTC)

Category Pages mode different
I have installed CategoryTree and made a few changes: * changing default mode to ALL in efCategoryTreeParserHook * omiting namespace

But when I go to a Category Page, the tree's mode appears to be Categories.

Does the CategoryPageSubclass.php file not use the default mode from CategoryTree.php?

129.186.146.159 19:31, 24 April 2007 (UTC)


 * it uses CategoryTree::renderNode directly, which defines its own default. See the renderNode function in CategoryTreeFunctions.php. Perhaps the default mode should indeed be a configuration option... -- Duesentrieb ⇌ 19:37, 24 April 2007 (UTC)

Is there a work around for this? I would really like to see the pages listed under the subcategories on a category page. --139.142.219.1 18:45, 30 April 2007 (UTC)


 * I have added options for the default mode for tags, and the mode used on category pages. Documentation has been updated. -- Duesentrieb ⇌ 12:16, 1 May 2007 (UTC)

More on Error: categoryTreeExpandNode is not defined
I to am having the same problem. I have looked at the trouble shooting page reference above and I see "If you are using rewrite rules or aliasing". I have checked my .htaccess and I am not doing anything there. When i enter the URL for the javascript file directly I do get redirected to the index page though.

The header fix mentioned above does not appear to be in in SVN yet. Not sure is this will fix my problem but can you give me a hint one which file / where is would implement it - many thanks --JulianY 07:28, 28 April 2007 (UTC)


 * Find out why your are being redirected when accessing the script. That is your problem right there, and there's nothing MediaWiki can do about it (this is a request for a plain file - MediaWiki is not even called. Or shouldn't be); If there's nothing in the .htaccess file, check .htaccess files in "parent" directories, and also for aliases defined in httpd.conf. Also make sure apache is allowed to serve files directly from the extension directory - maybe that is the problem.
 * the "header fix" discussed was only for the custom skin he was using. It simply works with all the default skins. -- 217.234.232.131 09:43, 28 April 2007 (UTC)

OK will do but i have a work around using a seperate server for the moment --JulianY 13:32, 2 May 2007 (UTC)

Enhancement Suggestions
This is a realy great extension and I would like to make a couple of enhancement suggestions;

mode="hideEnptyCatagories" this would hide category subtrees that do not contain any pages.

colls="#" this would instruct the  categorytree tag to lay it's contents over a number of columns

hidenamespace="true" so categories would be displayed at "Coaches Australia" not "Category:Coaches Australia"

Lastly a catagoryreecontents tag. When a tree node is expanded the content of the node is then displayed in this tag - if present --JulianY 13:32, 2 May 2007 (UTC)

Possible to show all categories
I have a very small wiki, with a very flat category structure. Is it possible to modify your script so it shows all the categories (they have no common root). I could just put multiple trees, one for each category, but then I would have to update it every time there was a new category.

Darstellungsart / Viewing
de: Eine Differenzierte Darstellung wäre nett. Z.B. ein Parameter zu übergeben, welches die CategorieTrees nicht untereinander sondern nebeneinander darstellt. en: Diffenret kinds of viewing-possibilitys. For example showing the Trees besides and not among each other.
 * You can do that using CSS by wrapping the category tree in a div that has a special CSS calss assigned. But i'm not sure how well a side-by-side display will work when expanding nodes... -- Duesentrieb ⇌ 10:16, 14 May 2007 (UTC)
 * OK I added div-tags around the categorytree-tags with white-space: nowrap; but it doesn't work.
 * I also added the white-space: nowrap; entrys to all classes in the CategoryTree.css and CategoryTree.rtl.css but nothing happens.
 * display: inline; doesn't works too!
 * --213.214.18.64 10:00, 24 May 2007 (UTC)
 * Using the style-argument in your categorytree-tag has no effect on breaks
 * Using the style-argument in your categorytree-tag has no effect on breaks

Categories Intersection
Hi. There's a way to use CatScan categories intersection with CategoryTree? It can be useful to get automatic lists for Portals. I use CategoryTree on w:it:Portale:Anime e manga, but adding a new intersection function on CategoryTree should make it more powerful and flexible. (and discourage composite categories creation) It's implementable?--Dzag 07:42, 19 May 2007 (UTC)

CategoryTree and Version 1.10.
I am using a own wiki (Mediawiki); Version 1.10. I tried to install categoryTree: I copied the categoryTree-Folder into extensions and added the two lines


 * $wgUseAjax = true;
 * require_once( "/CategoryTree.php" );

to the localsettings; it tried it also with the full path

require_once( "/var/www/w-handwerk/extensions/CategoryTree/CategoryTree.php" );

but I get always the error-message:

Parse error: syntax error, unexpected T_VARIABLE in /var/www/w-handwerk/LocalSettings.php on line 125

line 125 is the $wgUseAjax

what is wrong?

--DerBernie 19:10, 24 May 2007 (UTC)

Needs a mode restricting to the current page's namespace
the Pages mode leaves out articles in the Images namespace. There should also be a mode which limits articles to the same name namespace as article you're in, or a nominated namespace (as opposed to all namespaces except Images).

I have a silly question.
I've installed a personal wiki on my system at home, version 1.9.3. I've installed CategoryTree and it works fine. I've set the variables -

$wgCategoryTreeOmitNamespace = true; $wgCategoryTreeDynamicTag = true; $wgCategoryTreeDefaultMode = CT_MODE_PAGES; $wgCategoryTreeCategoryPageMode = CT_MODE_PAGES;

In the example shown in the box on the "Extension:CategoryTree" page, the "manual" category indents each child when you click on the minus sign. My system here at home does not indent the child pages that I create.

Q- Is there a variable that I need to set somewhere that will indent each child.

I suspect this is about me changing my style sheets or adding another extension to my system rather than what CategoryTree is doing.

--Allyn 17:25, 4 June 2007 (UTC)

Another question with 1.10.0
I've followed the instructions per the README file. When I try and use it with the tags, or use the Special to search for categories, it always says that the category cannot be found. I'm not getting any errors or anything. Any suggestions?

--Pndfam05 19:40, 29 July 2007 (UTC) It sounds like the problem I encountered with 1.10.1. CategoryTree will only locate categories when the category page has been created. When you open Special Pages:Categories are all of you category names red? If so then the category page has yet to be created. Try using one of the blue category names between the CategoryTree tags. If you do not have any blue category names then click on a red one, insert some text on the page, save it and then try CategoryTree again.

Older Versions
Is there a version of this extension that will run on mediawiki 1.65? My ISP will NOT upgrade the PHP software so I can't upgrade :-(

categorytree inside of a template
I'm using wiki version 1.10 and as far as i can see i can't use your extension in templates. for example

where COMPONENT is a valid category the result is empty. if i hardcode the category between the tags it works.

Articles in more than one Category
Could you include a function, that makes filtering possible?

For example:
 * Article A is in Category 1
 * Article B is in Category 2
 * Article C is in Category 1 and Category 2

now I type the following code into the wiki the result is Article A and Article C, because they are both in Category 1

I Would prefer the following function: the result is Article C because Article A would be filtered out.

Subcategory/article count
Is it possible to get a subcategory/article count (depending on the mode)? Otherwise I'm stuck with trying to do it with Dynamic Page List... -Eep² 03:33, 28 July 2007 (UTC)


 * Hello? I've done it with DPL but it doesn't have the javascript branching that CategoryTree does... More suggestions for options:


 * Use images for the "[+]"/"[-]" text controls (easier to click since the brackets don't work)
 * Display bullets for pages
 * Remember opened/closed branches (via cookie?)
 * -Eep² 05:13, 1 August 2007 (UTC)

how to set colors for category entries
Is there any way to set different colors for category entries based on some simple conditions? Thanks. -Guoqian