Extension talk:CategoryTree/Archive 02

=2008=

Viewing the tree in multiple columns
I have the following code: Currently this generates a list that are subcategories to the category "features". But the output of it is in a single column, which can get very long if there is a lot of subcategories underneath "features". Is it possible to format the output so the list is in multiple columns? Also, can it be done so it's arranged alphabetically (like the subcategories list generated automatically by the wiki itself -> this is actually the desired output i am trying to get) Thanks in advance!! 128.189.248.8

Problems with Colons in Categorynames
In German Wikipedia we have two toplevel Categories with a trailing Colon-Sign (":"). Categorytree.php seems to have problems to deal with colonsigns in the categoryname, but I think the idea of organizing categories in diffrent namespaces is valid und worthfull to support.

!Hauptkategorie [–] Vorlage: Probleme beim Laden der Daten. Bitte warte einen Moment und versuche es dann erneut. [–] Wikipedia: Probleme beim Laden der Daten. Bitte warte einen Moment und versuche es dann erneut. [–] Auszeichnung [+] Auszeichnungsart [+] Person nach Ehrung ..

Is it possbible to deal with such categories in a future release of the extension? In any other aspects this is a very usfull extension, many thanks for it. Kind regards, --Ollio 14:28, 6 January 2008 (UTC)


 * If this doesn't work, it'S a massive bug. Please report it on bugzilla so it doesn't get lost (there's a CategoryTree "component" there you can file it under). Sadly, I don'Ät have time now to look into it directly. Thanks -- Duesentrieb ⇌ 15:29, 6 January 2008 (UTC)


 * Is this problem already addressed or fixed in an upcoming release? -- BSDev 13:51, 2 December 2008 (UTC)

CategoryTree in Sidebar Clarification
I installed the js code from Extension:CategoryTree for inclusion of CatrgoryTree on the sidebar into common.js (not monotype.js which is reported as deprecated in my MW 1.10 installation), which displays a link to the CategoryTree page in the sidebar toolbox. This is fine, but I'd like to display the expandable CategoryTree itself in the sidebar, not a link to the CategoryTree page.

Can someone specify exactly how to do this in the sidebar? I now have the sidebar defaults:


 * navigation
 * mainpage|mainpage
 * portal-url|portal
 * currentevents-url|currentevents
 * recentchanges-url|recentchanges
 * randompage-url|randompage
 * helppage|help
 * http://meta.wikimedia.org/wiki/Help:Contents|User's Guide

Adding  , for example, gives a category tree rooted at Category:Top in the sidebar page view, but the tree doesn't appear in the sidebar itself. It doesn't matter where or how I place the parse function, with one or two asterisks or none. It's not a cache / refresh problem: I can add other parts and links w/ no problems. It appears that only links make it through to the sidebar, which seems to be part of the problem here.

The mod to function efCategoryTreeParserOutput in extensions/CategoryTree/CategoryTree.php seems to do nothing.

So, is this possible or is it wishful thinking?

--DJ 00:13, 18 January 2008 (UTC)


 * This requires a mod to MonoBook.php to enable normal wikitext in the sidebar, see Wikitext in side bar.
 * --DJ 19:23, 24 January 2008 (UTC)

I did all the required modifications and use in the sidebar, but there's still a problem with rendering. I get the tree's html source shown in the sidebar [–] Root ... and so on. Maybe i confused the sections of Monobook.php hmm? groovehunter 20:22, 21 February 2008 (UTC)


 * Have a look at following discussion. --WIKImaniac 12:49, 1 March 2008 (UTC)

"Error in my_thread_global_end: 1 threads didn't exit"

 * MediaWiki: 1.10.0
 * PHP: 5.2.5 (cgi-fcgi)
 * MySQL: 5.0.24-community-nt

I added CategoryTree so now the +/- signs appear and work. However, "Error in my_thread_global_end: 1 threads didn't exit" appears at the bottom of the page and as the last entry in most categories. What might cause this problem? --Fmmarianicolon 15:54, 21 January 2008 (UTC)


 * I have never heard of this error, it seems to be mysql related somehow. Not sure what aspect of the categorytree could trigger it, sorry. -- Duesentrieb ⇌ 16:29, 21 January 2008 (UTC)

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

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


 * I believe the above comment is outdated. I think it should now be:

$wgCategoryTreeCategoryPageOptions['mode'] = CT_MODE_PAGES;

But why does this not work: $wgCategoryTreeSpecialPageOptions['mode'] = CT_MODE_PAGES;

--Robinson Weijman 16:26, 23 January 2009 (UTC)

Can someone please answer this question: why does this not work:

$wgCategoryTreeSpecialPageOptions['mode'] = CT_MODE_PAGES;

??? --Robinson Weijman 20:10, 26 January 2009 (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 21 May 2008


 * 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. --6 July 2008


 * 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:
 * wait for MediaWiki 1.13 to be released
 * install the latest version of CategoryTree (after you have 1.13)
 * set $wgCategoryTreeSidebarRoot 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 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";
 * 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:

[hide]
 * 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? --27 August 2008


 * 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 --28 August 2008


 * 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 --28 August 2008


 * 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! :-). --28 August 2008

CategoryTree displays nothing?
Under SpecialPages >Category Tree, i try searching the category tree ..but it only give Category "XYZ" not found.

However the category XYZ exists !

I do not even see the + / - symbols on the page...

Anybody pls. help. --2 September 2008

Parser doesn't parse on MediaWiki: 1.11.0 with CategoryTree-MW1.11-r25491.tar.gz
I have updated CT to get the hideprefix=always option.

The CT tag goes right, but the parser is wrong Now I get the raw code in my page...

Look for examples on : http://www.wikitau.org/index.php5?title=Utilisateur:FrViPofm/categorytree

Parser doesn't parse on MediaWiki: 1.11.0 with CategoryTree-MW1.11-r25491.tar.gz

What is wrong ? Thanks in advance... FrViPofm 14:46, 2 September 2008 (UTC)


 * Don't know, but to get hideprefix=always, you need version 1.13 of both mediawiki and categorytree. that should work then anyway. -- Duesentrieb ⇌ 14:54, 2 September 2008 (UTC)


 * Ok I'have downgraded CT for IDontKnowWhitch version i used before. but the parser gives somthing like in the first post of this page : raw code. I had not test the parser tag before upgrading so I don't know if the problem is old or not.FrViPofm 15:38, 2 September 2008 (UTC)

Have page summary beside page link on category page??
The page summary would be from transcluding the relevant page (and using includeonly tags on the relevant pages).

Is this possible?

Cheers! Jonathan3 16:41, 4 September 2008 (UTC)


 * Use Extension:DynamicPageList for this kind of thing -- Duesentrieb ⇌ 17:09, 4 September 2008 (UTC)


 * Mega. Thanks Jonathan3 16:27, 9 September 2008 (UTC)

When used in the sidebar, can it be moved to below the search box?
I easily installed CategoryTree on MediaWiki version 1.13.1 and it is working perfectly. Thanks!

But I would like to have the search box above the category tree so that it doesn't get pushed down to where people have to scroll down to see it. So where in the code could I hack to move it to below the search box?

Thank you.
 * In MW 1.13.2 you can put the search box wherever you want on the sidebar. I've not used CT on sidebar so don't know if this will help you though.Jonathan3 22:28, 5 October 2008 (UTC)

Getting category to show number of (sub-categories and pages) separately e.g. (1C + 3P)
I'm sure I've seen this somewhere. e.g. instead of Category(2) it says Category (2C). How do I implement this? Many thanks, Jonathan3 21:20, 4 October 2008 (UTC)
 * To answer my own question, just copy the relevant system messages from the mediawiki site and make sure you're using ParserFunctions extension :-) Jonathan3 22:27, 5 October 2008 (UTC)

wrong if on CategoryTreepage.php, line 76
if ( $title && $title->getArticleID ) {

if id is 0 (zero) your test will fail. i have a category with id 0.

One of my categories appears as subcategory of itself.......
...and for the life of me I can't work out why. It just appears recursively... any idea why?? Jonathan3 23:18, 5 October 2008 (UTC)
 * To answer my own question, the subcategory title contained a subset of the category string. E.g. Category "X, Y or Z" and Subcategory "Z". I changed my category name which fixed the problem. I THINK THIS IS A BUG (although not a major one) :-) Jonathan3 23:29, 5 October 2008 (UTC)
 * P.S. I have another category/subcategory similar and it doesn't have the same problem. Weird! But the problem described above did resolve immediately after I changed the name. Hmmm. Jonathan3 00:44, 6 October 2008 (UTC)

Featurerequest: Extend mode attribute with type "media"
Hi, is it possible to add a new mode "media" to only show media files associated with a category? Thanks in advance.

Sidebar not displaying pages
I added the Category Tree extension to my Wiki, it displays the tree in the sidebar as desired, but does not display pages that are connected to the categories. I tried adding several lines to LocalSettings.php to get it to show pages but cannot figure out what the correct command line is. Can anyone tell me what the line should read?
 * Got my question answered $wgCategoryTreeSidebarOptions['mode'] = CT_MODE_PAGES; worked
 * You'll probably never see this but BLESS YOU.

CategoryTree sidebar in MistyLook skin?
Does anyone have any idea how to enable the CategoryTree in the sidebar with the MistyLook skin? --Wordchisler 18:44, 28 October 2008 (UTC) P.S. I am using Mediawiki 1.13. P.P.S. MistyLook User Styles


 * I got it to work. In case it helps anyone else with a custom skin, here's what I did. (Note: I do not know php, so use at your own risk. I also suggest copying the relevant text from your original Monobook skin, rather than the below).

Starting on line 221 of Mistylook.php I replaced the following:

<ul> <?php 			foreach($cont as $key => $val) { ?> <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php if ( $val['active'] ) { ?> class="active" <?php } ?>>"><?php echo htmlspecialchars($val['text']) ?></a></li> <?php			} ?> </ul>

with the following from Monobook: <?php  if ( is_array( $cont ) ) { ?> <ul> <?php 			foreach($cont as $key => $val) { ?> <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php if ( $val['active'] ) { ?> class="active" <?php } ?>>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li> <?php			} ?> </ul> <?php  } else { # allow raw HTML block to be defined by extensions print $cont; } ?>

--Wordchisler 22:08, 31 October 2008 (UTC)

Specific PHP Version requirements?
Does this extension require PHP5? Or does it require specific PHP settings?

I'm getting an Error: Fatal error: Cannot instantiate non-existent class: categorytree in / /wiki/w/extensions/CategoryTree/CategoryTree.php on line 336

which makes me think that autoloading isn't working or my php install is not meeting requirements.


 * 1) MediaWiki: 1.6.10
 * 2) PHP: 4.4.7 (apache2handler)
 * 3) MySQL: 4.0.18-log

Could the requirements page be updated if they are known?

Dead End Notification
As already suggested previously a dead end notification option would be very nice. It is annoying for users in mode "categories" to open a Category with the "+" sign that has no further subcategories. This should be signed with an "x" too. Extension_talk:CategoryTree/Archive_01

Special Page with predefined category
Is there an option to predefine a category that is then automatically selected and shown on the special page? -- BSDev 09:04, 8 December 2008 (UTC)