Extension talk:CategoryTree/LQT Archive 1

Parser Function
I am using MediaWiki 1.11.0 with ParserFunctions v1.1 and ExtensionFunctions.php. Everything is recently installed within the last few days. Special:CategoryTree works perfectly, as does
 * 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)
 * Still works fine with MediaWiki v1.10.0 --WIKImaniac 15:24, 22 August 2007 (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)

Now that a hack is no longer needed to remove the "Category:" namespace prefix, I am looking for a hack to "hack" a little more off the front end of my category names. In my application, each category is preceded by an uniformly formatted ID. Is it possible to replace the category text with a truncated copy of the text? If so, is it possible to evaluate the category text to determine if the leading characters meet a certain formatting criteria, and then make such a replacement? If so (going out on a limb here), how and where would I write the equivalent of the following SQL statement? SET category = Mid(category,17) WHERE category Like '(##) ## ## ## - *';


 * - Furboy 22:43, 6 December 2007 (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

- is this possilbe? in would like to have the tree split in 3 columns (because it's big) --89.212.65.33 12:27, 23 October 2007 (UTC)

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.


 * I would like to second this request. I also have a small site with relatively few categories and.  My maximum depth is 3 or 4. - Tnabtaf 00:03, 29 January 2008 (UTC)

Just make a root category, and hide it when showing the tree. -- Duesentrieb ⇌ 14:59, 29 January 2008 (UTC)

Here is a quick and dirty patch to do it (just let the categorytree tag with an empty category name): --- CategoryTree/CategoryTreeFunctions.php	2008-06-10 11:49:07.968750000 +0900 +++ CategoryTree2/CategoryTreeFunctions.php	2008-06-13 18:06:00.578125000 +0900 @@ -122,20 +122,32 @@ 		$this->mIsAjaxRequest = false; $category = trim( $category ); -		if ( $category === '' ) { -			return false; -		} -		if ( $wgCategoryTreeDisableCache && !$wgCategoryTreeDynamicTag ) { -			$parser->disableCache; +		if ( $category !== '' ) { +			if ( $wgCategoryTreeDisableCache && !$wgCategoryTreeDynamicTag ) { +				$parser->disableCache; +			} +			$title = self::makeTitle( $category ); } -		$title = self::makeTitle( $category ); - -		if ( $title === false || $title === NULL ) return false; $html = ''; $html .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeTag', 'style' => $style ) ); -		if ( !$title->getArticleID ) { +		if ( $category === '' || $title === false || $title === NULL ) { +			$dbr = wfGetDB( DB_SLAVE ); +			$sql = 'SELECT page_title AS title '; /* categories not belonging to any category */ +			$sql .= 'FROM '.$dbr->tableName('page').' '; +			$sql .= 'LEFT JOIN '.$dbr->tableName('categorylinks').' ON page_id=cl_from '; +			$sql .= 'WHERE cl_from IS NULL AND page_namespace='.NS_CATEGORY.' AND page_is_redirect=0 '; +			$sql .= 'UNION '; +			$sql .= 'SELECT cl_to AS title '; /* categories without associated page */ +			$sql .= 'FROM '.$dbr->tableName('categorylinks').' '; +			$sql .= 'LEFT JOIN '.$dbr->tableName('page').' ON cl_to = page_title AND page_namespace = '.NS_CATEGORY.' '; +			$sql .= 'WHERE page_title IS NULL '; +			$res = $dbr->query( $sql ); +			while ($row = $dbr->fetchObject( $res )) +				$html .= CategoryTree::renderNode( self::makeTitle($row->title), $mode, $depth>0, $wgCategoryTreeDynamicTag, $depth-1 ); +		} +		elseif ( !$title->getArticleID ) { $html .= Xml::openElement( 'span', array( 'class' => 'CategoryTreeNotice' ) ); $html .= self::msg( 'not-found', htmlspecialchars( $category ) ); $html .= Xml::closeElement( 'span' );

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)


 * I have encounted the same problem. The cause of the problem was that I have moved the extensions folder to a different location. I created a symbolic link from the original location to the new one, and then indentation worked. --Tillmo 13:05, 13 November 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 :-(

- I have the same problem.. how do you locate older revisions?

CategoryTree will not work with anything < MediaWiki 1.8, sorry. -- Duesentrieb ⇌ 21:28, 18 November 2007 (UTC)

Looking at Wikipedia's Version page, it looks like they are running CategoryTree Version r34306 on MediaWiki 1.13alpha?

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.


 * I don't think I'll open that can of worms. From writing meta:User:Duesentrieb/CatScan, I know that there are lots of filters that would be nice to have, and that it's quite hard to write efficient database queries for them - especially since people want to combine them.
 * As to your example: the syntax seems odd. To me, "|" would indicate the union, not the intersection, of the two categories. "&" could be used for intersection, but that's a valid title character, wich makes it tricky.
 * Maybe I'll add a way to hook into CategoryTree, to allow people to write their own filters, with a minimum of PHP codeing. But even that could proove tricky... -- Duesentrieb ⇌ 13:46, 25 August 2007 (UTC)

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)


 * Couting the elements in a category is as expensive as listing them. When showing 100 categories, it would amount to 100 additional database queries (using subqueries doesn't make it much better). This type of overhead is not acceptable. -Duesentrieb


 * To you, perhaps, but on a smaller wiki it's negligible. Leave it up the wiki owner to decide. -Eep


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


 * Images don't scale and should be avoided as UI elements. Making the brackats clickable would be possible, but making them look link-ish would be ugly, IMHO. -Duesentrieb


 * Leave that up to the wiki owner as to which image should be used and how the text link should look like (like use "[$1]" in a system message and allow the $1 to be configurable too, as text or an image), but simple adding an image scale proportion adjustment parameter would be sufficient if it concerns you that much. However, you don't see such issues arise in favicons (16x16) and even default Windows desktop icon sizes (which range from 16x16 to 48x48 but 32x32 is the most common). -Eep


 * Display bullets for pages


 * Maybe. Yea, why not. When I have time. -Duesentrieb


 * Remember opened/closed branches (via cookie?)


 * this would case some massive overhead when flipping through your browser history. It would also be a mess to code, basically spamming you with dozents of cookies, or cluttering the session data on the server. I don't think it's wort it. -Duesentrieb


 * Again, leave that up to the wiki owner to decide. Why limit functionality based on what you think will cause "spamming" and server session data cluttering? -Eep


 * -Eep² 05:13, 1 August 2007 (UTC)


 * I second these - I think these are great suggestions (though of course I'm not a coder, so that's just my opinion). Also, I hope that in time, cats without subcats will automatically display a "[-]" instead of a "[+]" even before being clicked. --Chriswaterguy 09:15, 11 August 2007 (UTC)


 * $wgCategoryTreeOmitNamespace</tt> "doesn't show the namespace name for pages and categories. Default is false, namespaces are shown unless showing categories only." But I would like an option to show all namespaces except "category:" for all modes. Specifically, I want "template:" visible with CT_MODE_ALL</tt> and CT_MODE_PAGES</tt> and I would like to force more than one level of branching to automatically open. I can't get this to work at all even with this: $wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 3, CT_MODE_ALL => 3, CT_MODE_CATEGORIES => 3);</tt>. —Eep² 07:53, 25 August 2007 (UTC)


 * This would be inconsistent, since Pages would look the same as Categories (ok, except for the [+] up front). I don't like inconsistencies like that, and too many modes make the code overly complex (see en:Feeping_creaturism); -Duesentrieb


 * It's not, really. This is for when pages are displayed under categories, because there is only italics to represent pages/articles, categories are distinguished. However, if there are templates and other namespaces, same-named pages in different namespaces look like duplicates. I'd rather have the namespace in front for pages/articles under subcategories in these instances. -Eep


 * Opening more level initially: I don't really like this feature, it was added by someone else. However, it seems to work ok when I tested it, and your configuration looks fine (assuming you are setting the depth attribute in the &lt;categorytree> tag). -Duesentrieb


 * No, I'm not using a tag but instead the default category page. I want at least the first level open for each subcategory on category pages by default without having to use a tag. -Eep


 * Regards -- Duesentrieb ⇌ 14:03, 25 August 2007 (UTC)


 * —Eep² 22:34, 26 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

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.


 * I'm also having this problem - see Appropedia:Template:Topic bottom & Appropedia:Template:Category tree. Can this be overcome? --Chriswaterguy 09:15, 11 August 2007 (UTC)


 * I also would like to request this feature. Guoqian 09:37, 12 September 2007

This is a fundamental problem of all tag-type extensions, and there is no easy solution. see 2257 -- Duesentrieb ⇌ 09:26, 13 September 2007 (UTC)

UPDATE: I just committed an update that allows you to use parser function syntax to put a category tree on a page - see The parser function. Parser functions allow the use of variables, templates and template parameters. Try it. -- Duesentrieb ⇌ 11:25, 13 September 2007 (UTC)
 * I updated the latest version, but did not work. Wiki shows  itself. if I use , Wiki shows nothing. I am using Mediawiki 1.11.0rc1, php5.1.1, mySQL 4.1.16. I have ParserFunctions extension installed. Am I missing something? Guoqian 12:44pm, 13 September 2007
 * OK. As you re-indicated in categorytree homepage, the syntax should be . It works now. Thank you very much.Guoqian 8:05pm, 13 September 2007

Problems on MW 1.10.1
When clicking the [+] next to a category tree, I get:

400 Bad Request: Warning: in_array [function.in-array]: Wrong datatype for second argument in /var/www/mw_codebase/1.10.x/w/includes/AjaxDispatcher.php on       line 61 Bad Request unknown function efCategoryTreeAjaxWrapper

I'm using - CategoryTree, downloaded from svn trunk today 9:th of Aug 2007 - - (tried as well with the version from 2006 on http://tools.wikimedia.de/~daniel/downloads/ with the same result) - MediaWiki 1.10.1 - Ubuntu server 6.06 - Apache 2.0.55 - PHP 5.1.2

It seems like Wikia had the same problem, see: http://www.wikia.com/wiki/Forum:Category_tree

Anyone details about how this was solved, anybody? Best Regards, --SHL

Changes for $wgCategoryTreeCategoryPageMode show no effect
I'm Using MW 1.10.0. I tried to change the category page mode to CT_MODE_PAGES but it's showing no effect. I read the Troubleshooting, should work fine. What did I forget?

-- 15:39, 15 August 2007 (UTC)

Same Problem. I Use $wgCategoryTreeDefaultOptions=all; because i want that all pages in the category X ist listen below that.


 * try again, and read closely: $wgCategoryTreeCategoryPageMode = 'all';</tt>
 * what version are you using, btw? -- Duesentrieb ⇌ 14:31, 2 July 2008 (UTC)


 * can't remember. I've installed the latest version now (r38543) but I still do have the same old problem. should get that extension working, soon... :/ .. MW Version is 1.12.0 --212.62.202.164 10:56, 4 August 2008 (UTC)


 * The latest version does not work with 1.12. Pick 1.12 on Special:ExtensionDistributor/CategoryTree or wait for 1.13 to be released (should happen any minute now). -- Duesentrieb ⇌ 14:18, 4 August 2008 (UTC)


 * awesome, it's working. after all.
 * thanks a lot daniel! --212.62.202.164 10:07, 28 August 2008 (UTC)

CategoryTree in SideBar Problem
Hi guys hope you can help. Ive got the CategoryTree working in the SideBar but there is a problem. It works fine when expanding out the tree on the Main Page. I can click on a child on the Main page and it goes to the right location. However, when Im at the new location other than the Main Page, I get a similar problem to what has already been discussed under "Clicking the [+] has no effect / gives JavaScript error".

The thing is: 1) On the new page, I can click on the root of the category tree, and it takes me to the right location. 2) On the new page, I can click on the root and goes to that root fine, but I cannot expand that roots children out. I CAN expand the CategoryTree out successfully on the Main Page only, but no other page.

The error code Im getting on pages other than the Main Page when using the CategoryTree from the sidebar is: Line 671 Char33 Error:Object Expected Code:0 URL: <the url of the new page Im currently on> I have checked all is correct with the notes on "Clicking the [+] has no effect / gives JavaScript error".

SUMMARY:

On the Main Page: I can expand the category tree successfully, and click on children successfully. On Pages other than the Main: [+]Category (If I click this, it goes to this page) [+]Category (If I click this, it goes to this page) [+]Category (If I click this, it goes to this page) eg. [+]VBScript (If I click on VBSScript, it goes to http://localhost/mediawiki/index.php/Category:VBScript When I hover over the [+] next to VBScript, the path is looking at http://localhost/mediawiki/index.php/Category:VBScript# Questions. This error Im getting. What file is the error coming from, and how to correct? Thank you.
 * 1) I can click on the root of each category and go to that page:
 * 1) If I try and click on the [+] sign next to the Category Name, eg. the [+] next to VBScript, I get the error message.

CategoryTree in SideBar Problem - "Solution" Found
Hi guys I posted a question on discussion and thought I share Duesentrieb's solution which WORKS!! yay! Problem: Ive got the CategoryTree working in the SideBar but there is a problem. It works fine when expanding out the tree on the Main Page. I can click on a child on the Main page and it goes to the right location. However, when Im at the new location other than the Main Page, I get a similar problem to what has already been discussed under "Clicking the [+] has no effect / gives JavaScript error". Solution: Open CategoryTree.php find the function efCategoryTreeParserOutput Change it to read: function efCategoryTreeParserOutput( &$outputPage, &$parserOutput ) { CategoryTree::setHeaders( $outputPage ); } Thank you Duesentrieb

A Small Modification
Just add the return true; to the above codes to avoid internal wrong massages if you get them:

function efCategoryTreeParserOutput( &$outputPage, &$parserOutput ) { CategoryTree::setHeaders( $outputPage ); return true; }

Adding a Category Tree [+] Tab next to Edit, History, Protect, Delete
Hi guys, Just wondering how you would go about adding: 1) An extra tab next to Edit, History, Protect, Delete, for every page. 2) A Category Tree [+] tab next to Edit, History, Protect, Delete, for every page. Thank you.
 * What exactly would that tag do? Take you to Special:CategoryTree? It can't expand in-place, that would put the tree inside the tab... or would you want something like a "popup"?
 * Also, what category should that tab refer to? Or do you only want it on category pages?
 * Furthermore, "+" is a bad choice: On talk pages, there already is a tab labeled "+", which creates a new section.
 * Can you clarify? -- Duesentrieb ⇌ 09:31, 13 September 2007 (UTC)

Category not found with mediawiki 1.11.0
On a brand new installation of mediawiki 1.11.0 I've created two categories using http://www.mediawiki.org/wiki/Extension:TagAsCategory and they both appear in Special:Categories, however neither can be found on Special:CategoryTree. I have added pages to both categories yet Special:CategoryTree reports "Category ... not found".

Thanks, Simon.
 * Please give a link to a page that shows this problem, or at least explain exactly what the categories are called, and what syntax and parameters you used with CategoryTree -- Duesentrieb ⇌ 08:38, 18 September 2007 (UTC)

Ok, sorry for not explaining in more detail. Unfortunately I cannot provide an external link to the wiki. I have two categories; "Testcat" and "Othercat". Testcat has two pages, "Testpage" and "Testpage2". Othercat has "Testpage3" and "Testpage4". On the Special:Categories page both Categories are listed successfully and they both have 2 members each. However when I search for Testcat or Othercat on the Special:CategoryTree page it returns "Category Testcat not found". Also, when I insert into the page markup the page displays "Category Testcat not found". I have Javascript enabled and I created the two categories using http://www.mediawiki.org/wiki/Extension:TagAsCategory. I downloaded CategoryTree from svn on Tuesday 18th Sept. Thanks in advance.


 * Do the category pages exist? i.e. are links to the category blue? if they are red, the category has "content", but no "page", and categorytree will list them as non-existant.-- Duesentrieb ⇌ 13:48, 24 September 2007 (UTC)

Yep, thats the problem. Many thanks!

Clicking on [+] results in loading but nothing loads
I have a problem, I installed categorytree on my wiki (http://sustainablex.com/en/index.php?title=Portal:Wind) but when I open the [+] the tree it stops at loading. I also have the same problem as the previous post.


 * Extension:CategoryTree -- 217.234.227.195 14:42, 21 September 2007 (UTC)


 * The server serves the js files to the browser
 * Hack to load files on each page made
 * Latest svn installed
 * I am still having no joy with this and I really need this extension to work, thanks for any suggestions. Sustainablex ⇌ 10:35, 22 September 2007 (GMT)
 * check the error console for any js errors you might be getting. -- Duesentrieb ⇌ 13:46, 24 September 2007 (UTC)


 * I encounter the same problem - although I have checked all the things in Extension:CategoryTree.
 * As reported under "Problem with Firefox" above, 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".
 * However, this is not a firefox problem! Namely, with my Firefox 2.0.0.8 I can use the category tree on Extension:CategoryTree without any problems. Hence, this wiki must be configured somehow in a way different from my wiki. Any hints? --Tillmo 10:49, 4 November 2007 (UTC)


 * I solved the problem through my ISP. I checked an option in my ISPs control panel to enable it to run scripts, this took a day or so for them to move it to a server that ran scripts. Also a minor frustration I had was getting the tree to work on a wiki page, it turns out that it will not load unless the category has a parent or something written in it. -- Sustainablex ⇌ 09:34, 07 Novemeber 2007 (BST)


 * By chance, I solved the problem in the following way: in the file includes/DefaultSettings.php change the following (MediaWiki version 1.11.0):

74c74 <    && (    ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 ) --- >     && (    ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 8080  )
 * You can also save these lines into a file named patchfile and then execute

patch DefaultSettings.php patchfile
 * --Tillmo 12:36, 13 November 2007 (UTC)

Reverse Proxy Engineered Wiki
Same problem occures while trying to reverse proxy a wiki. This technique is commonly used by corporate intranet sites and wiki's, e.g. External address: https://company.com/wiki, Internal address: http://co.local/wiki.

Solution: (works on intranet as well as 'outside'): Change the wiki/skins/common/ajax.js as followed:

Reason: wgServer is your local server Address (i.e. 10.0.0.x).

Now your employee loggs on from an external source and tries to access https://company.com/wiki, but gets the imfamous "Error: uncaught exception: The permission to call the method XMLHttpRequest.open was not granted" error message (in FF at least he does, otherwise he gets an Access Denied Error on       line ~109, char 3).

Keep in mind that wgServer points to an internal IP-address, and is invalid for an external user.

Hope this can be fixed in future releases of MediaWiki, absolute URLs must be avoided, due to portability, migration and rare cases of reverse proxy engineered intranet-sites.

--Kaspera 11:39, 3 December 2007 (UTC)

Clicking on [+] results in message Problem loading data. Please wait a moment and try again.
I have this problem - installed CategoryTree in the latest version (http://www.ppoe.at/leiter/wiwo/wiki/index.php/Kategorie:Hauptkategorie). I am running MediaWiki: 1.8.2, PHP: 5.1.1 (apache2handler), MySQL: 4.1.16-nt. Have anyone an idea? I have tested it with Internet Explorer 7, 6 and 5 and Mozilla Firefox 2.0.0.3 - same results with every browser...

Can anybody help? Wäre echt super... Schon jetzt Danke dafür!

lg Tobias


 * Problem gelöst mit Update auf neueste Mediawiki-Version - glg Tobias

Omit Namespace
Is there a way to omit the namespace without using $wgCategoryTreeOmitNamespace = true? I'm on Wikipedia and wish to use with this enabled (or rather disabled) for all viewers without having to instal the CategoryTree extension. Is there a way to do this similar to how mode is chosen (<category tree mode="all" omit namespace="on">)?


 * I'm very reluctant to add more options, for technical reasons: adding an option means adding parameters to multiple php functions, and mutliple places in the JavaScript code, and also considering all options when creating cache keys - all of which needs to be kept consistent. this makes the code more prone to oversights and errors, and it also makes caching less effective.
 * This is a general problem with ajax-based extensions. If I come up with a nice and clean mechanism to handle options for ajax calls, I'll be happy to use it for the category tree too. -- Duesentrieb ⇌ 08:52, 22 September 2007 (UTC)


 * Sounds like the code isn't optimized very well then... You may want to consider a rewrite so adding things is easier. I'd like to be able to have the non-category namespaces show, for example, but as CategoryTree currently is coded, it's all namespaces or nothing. :/ —Eek 21:07, 22 September 2007 (UTC)


 * optimization is about performance, not about flexibility or modularity of the code. But yes, it sucks that it's hard to add options. Feel free to rewrite it. I have it on my todo list, somewhere around position 42311. -- Duesentrieb ⇌ 21:50, 26 September 2007 (UTC)

Depth
The depth option will not work for me on Wikipedia. When I put which shows up in Special:Version. Siebrand 00:04, 26 February 2008 (UTC)
 * The problem with hand-maintained version numbers in code, especially if edited by multiple people, is that often the code gets changed but the version number is not incremented. I feel that no version number is better than a misleading version number. -- Duesentrieb ⇌ 09:20, 26 February 2008 (UTC)
 * Feel free to add svn-keywords and use $Rev$ as a version ID. IIRC, before it did not have a version ID at all. Cheers! Siebrand 12:42, 26 February 2008 (UTC)
 * Ah, for some reason i thought keyword replacment was disabled on the repos. But i guess it was just decided not to used it for mediawiki. I have added it to CategoryTree, my other extensions will follow in time. -- Duesentrieb ⇌ 10:39, 27 February 2008 (UTC)
 * You did some interesting trickery with the string replacement in ExtensionCredits. I think I like that. Siebrand 13:40, 27 February 2008 (UTC)

Multiple Column parameter
This has been brought up before (above), but I couldn't find an answer. I used Extension:CategoryTree at this category. The tree now is one column. Is there a way to make the tree two columns (e.g., the parameter colls="#" would instruct the categorytree tag to lay it's contents over a number of columns)? If not, please add a parameter to Extension:CategoryTree to allow the CategoryTree to fall over two columns. Thanks. GregManninLB 16:29, 26 March 2008 (UTC)
 * I don't know how I would even begin to implement something like this. Or if i even understand what you are trying to do... -- Duesentrieb ⇌ 22:21, 9 April 2008 (UTC)

CategoryTree in other Namespaces
Can CategoryTree work in custom namespaces? The way we construct our wiki is through Book-> Chapter -> Section and we would like to use this to provide a dynamic Table of Contents. I just can't figure out how to use it on another namespace. Is there a variable you can enter to change the namepace for that call to the CategoryTree extension? If not, is this an enhancement planned for the future? Thanks, --Greg 17:05, 9 April 2008 (UTC)


 * Uh, categories live in the category namespace, per definition. I'm afraid I don't quite understandwhat you mean. For a dynamic table of content, perhaps Extension:Hierarchy or Extension:DynamicPageList will work better. -- Duesentrieb ⇌ 22:19, 9 April 2008 (UTC)

Thank you very much! That is exactly what I was wanting. --Greg 22:39, 9 April 2008 (UTC)

CategoryTree automatically open in the sidebar
I've install CategoryTree in my sidebar and it works great but when I go on a page throw the Tree, once the page open, the tree close itself. Is there a solution to keep it the way it was before clicking on it ? I've thinking about a solution which could solve the problem partially : when a page is open, a script looks in which category the page is and then it change the tag   to    Can you help me doing something like this ? Thank you for your extension, --Teriblus 15:57, 11 April 2008 (UTC)

I would like to second this request ... And I realise that this is not exactly easy to implement :-| -- Thoralf 13:04, 29 August 2008 (UTC)


 * This will not work for several reasons.
 * tags are evaluated server side, before anything is sent to the browser, so also before any JavaScript is evaluated.
 * pages may be in multiple categories
 * The first problem can be overcome by adding a feature to the extension code itself that will look which categories the current page is in. However, expanding the tree to appropriate depth is tricky, there may be several valid paths through the category structure, and for finding such a path multiple database queries are needed, which makes this extremely inefficient. And it would still not provide a solution to the second point.
 * It's important to keep in mind that a wiki's category structure often is not a tree - the tree view is a projection of the actual structure. Because of this, such a tree does not provide a location of each page: pages and even categories may show up in multiple places in the tree, there may even be loops. -- Duesentrieb ⇌ 14:05, 29 August 2008 (UTC)

Click the + has no effect in edit pages in the sidebar
Hi,

I installed the extention and make it works in the sidebar for all pages in the main namespace but I get the problem that clicking the + has no effect when I'm on a special page or when I'm editing a page...

Can you help me ? Thanks. --Teriblus 08:50, 7 May 2008 (UTC)

category tree in Category pages
You know how the tree automatically is inserted in Category pages? It will only list Categories and subcategories. How do I make it list articles as well? Is there a template or something? thanks. —The preceding unsigned comment was added by 24.209.232.92 (talk • contribs) 19:00, 7 May 2008 (UTC). Please sign your posts with ~ !

$wgCategoryTreeCategoryPageMode = CT_MODE_ALL;

-- Duesentrieb ⇌ 20:06, 7 May 2008 (UTC)

Fatal Error and Wampserver?
Hi all, I have the latest version of MediaWiki running on Wampserver. When I try to use category tree, however, I get the following error message:

Fatal error: Call to undefined function wfLoadExtensionMessages in C:\wikidirectory\extensions\CategoryTree\CategoryTreeFunctions.php on line 405

This happens even if I disable all other extensions. Any ideas why? Does Wampserver not allow Ajax or something? Thanks for any help. Dwharrington


 * your version of CategoryTree is incompatible with your (old) version of MediaWiki. Update mediawiki, or downgrade CategoryTree from svn. -- Duesentrieb ⇌ 14:33, 2 July 2008 (UTC)

depth="0" and onlyroot
onlyroot isn't the same as depth="0": only root means "show only the root, and the user can open the tree and see all the relvent catagories/pages (depends on mode)" while in depth="0" I can't see pages, only catagories, when using mode all. ערן 08:21, 4 July 2008 (UTC)
 * Works for me with the latest version of CategoryTree (checked with 36978, should work since 36864). In older versions, the depth parameter is quirky. What version are you using, exactly? -- Duesentrieb ⇌ 13:10, 4 July 2008 (UTC)
 * It didn't work properly few hours ago in Hebrew Wikipedia, but now it works fine. ערן 14:36, 4 July 2008 (UTC)
 * Oh... it has gone live... :) -- Duesentrieb ⇌ 19:12, 4 July 2008 (UTC)

Newfromrow function error
Hi. I have newly set extension for my wiki. I have uploaded to extensions directory and edited the Localsettings.php file enabled ajax etc. Well the problem is when I give mode=pages parameter it gives an error:

Fatal error: Call to undefined method Title::newfromrow in /home/content/wiki/extensions/CategoryTree/CategoryTreeFunctions.php on line 481

When I debugged the code I realized that there really isn't a function declaration of newfromrow.

On the other hand, if I don't use mode=pages parameter it works correctly.

How can I fix that?

Thank you.


 * Don't use the latest version of CategoryTree unless you are also using the latest version of MediaWiki. If you use the latest *stable* version of MediaWiki (as you probably should), select 1.12.x on the download page -- Duesentrieb ⇌ 21:05, 6 July 2008 (UTC)

CategoryTree as a tree in SideBar
Hi folks. I’ve read all of this (include links) but still don’t understand how to integrate a CategoryTree in the sidebar not as a link (I know how to do that) but that it shows the tree.

Could someone explain it step by step or refer me to such explanation? I know maybe it looks stupid but I can’t read it now and again : (

Thank you. --Prosector 07:11, 18 July 2008 (UTC)

Three steps:
 * 1) wait for MediaWiki 1.13 to be released
 * 2) install the latest version of CategoryTree (after you have 1.13)
 * 3) set $wgCategoryTreeSidebarRoot</tt> to the name of the category you want to use as a root for navigation.

The solutions presented above are more or less dirty hacks... I for one never got them to work :) -- Duesentrieb ⇌ 13:50, 18 July 2008 (UTC)

Thanks a lot Duesentrieb! I’ve already read about $wgCategoryTreeSidebarRoot</tt> but didn’t understand what did it mean. How to set it and where? --Prosector 17:44, 18 July 2008 (UTC)


 * You set it in LocalSettings.php - like all configuration. After including the extension. If your root category is called "Everything", you would use the following:
 * $wgCategoryTreeSidebarRoot = "Everything";</tt>
 * This will make all subcategories of Category:Everything show in the sidebar -- Duesentrieb ⇌ 08:05, 19 July 2008 (UTC)
 * Now I understand everything. Thanks again Duesentrieb! --Prosector 02:29, 20 July 2008 (UTC)

Conversion for an outline
Any suggestions on how to tweak this for use in an outline? For example, I have an outline that is 10 deep and a couple hundred long. It'd be nice to be able to have just the top level visible until someone clicks on the plus + next to it.

98.100.137.42 00:34, 25 July 2008 (UTC)


 * I assume that with "outline" you mean nested lists entered by hand on a single page. That is very different from a technical point of view, even if it looks similar. I don't see a good way to use CategoryTree for that. There are show/hide functions for html blocks used for the TOC -- perhaps look into how they are triggered, and try to recycle them (or copy & adopt). The respective HTML bit looks like this:

[<a href="javascript:toggleToc" class="internal" id="togglelink">hide</a>]
 * I suggest to start digging there. -- Duesentrieb ⇌ 07:07, 25 July 2008 (UTC)

No [+] on category pages
I've done the install with default settings. If I use the tags or the special page it works. My category pages however do not have a [+] for sub categories. Any ideas? 210.1.210.137 12:05, 24 August 2008 (UTC)
 * No clue how that could happen. Got a link? -- Duesentrieb ⇌ 12:17, 24 August 2008 (UTC)
 * Have found out why. Somehow my wiki is reporting that it's the latest code but it isn't. The css wasn't being inserted. A wiki on a subdomain worked first go which gave me the clue. Thanks for the offer to help. 210.1.210.137 12:34, 24 August 2008 (UTC)

How to use CategoryTree directly on a category page?
Does anyone know how to use CategoryTree directly on a category page? In the Usage section, it says: CategoryTree can be used in three ways: directly on the category pages, as a custom tag, etc

Let's say I have a category called Model. Must I write in the Model category page?


 * No. All subcategories shown on the page will have a clickable [+] automatically (like on wikipedia). If not, something is quite wrong :) -- Duesentrieb ⇌ 19:32, 27 August 2008 (UTC)

This works for me, but is not what I meant. If I open a category page, say http://www.mywiki.org/wiki/index.php?title=Category:MyTopCategory

then, without the CategoryTree-extension, all subcategories of MyTopCategory are listed automatically. I was hoping to replace this list with a clickable tree view, automatically, but I can't figure out how to. No tree view will be displayed without using the -tag for MyTopCategory. /PP


 * I'm confused now. If it works for you, each subcategory is displayed as a (collapsed) tree view. So there's not a single tree, but one for each subcategory. Or to put it differently, the first level of the tree is shown in multiple columns, to better match the layout of the category page.
 * Basically, what you want is to show them all in a single column, so it looks more like a tree? Actually, that used to be an option, but I removed it in the latest version, because no one used it and it was difficult to maintain and fell into disrepair. So this is kind of a bad time to want that :) -- Duesentrieb ⇌ 08:24, 28 August 2008 (UTC)

OK, to visualize the problem, here is the link to my page: http://heureka.resgeom.slu.se/wiki/index.php?title=Category:Model As you can see, there is both the tree view and the standard list of subcategories. I only want to display the tree view. Also, I had to use the - tag to display the tree view (please, look at the source). /PP


 * So, it does not work for you as expected, i.e. subcategories do not automatically get a clickable [+] on category pages. They should, compare Wikipedia. I don't know why, but it may be caused by some incompatibility - I suggest to upgrade both your wiki and CategoryTree to the latest stable version (1.13) -- also see the question above yours.
 * If you really want a single column tree view, i'm afraid you are out of luck. You can only get that manually, like you have it now, and you'll have the redundant listing below that. -- Duesentrieb ⇌ 11:03, 28 August 2008 (UTC)

After upgrading from 1.12 to 1.13 it works. Thanks! :-).