Jump to content

Extension talk:CategoryTree/Archive 05

From mediawiki.org

I'm using CategoryTree in the sidebar of my site as the primary means of navigation. It's working great, except that you have to wait for the page links to load when you expand a category. (This becomes particularly tedious when you have to wait for them to load every time you want to navigate to a new page.) It would work much better if it would preload the page links in the background so they would instantly appear when you expand the category. I haven't found a setting to do this, but maybe it exists? Or is there a way to tweak it to do this? Maybe this is just a feature-request. --Waltztime 17:06, 23 September 2011 (UTC)Reply

Hang on loading after upgrade

I've just upgraded my wiki from 1.15 to 1.17, got the categorytree from the SVN today but my categories are not working and the extensions is hung on on "loading...". I followed all the instructions (.htaccess rule, ajax enabled and so) but nothing. Can you please give me a hint? Thanx! 93.62.139.46 10:43, 13 July 2011 (UTC)Reply

Screencap

It would be cool to see a screencap on this article. I'm going to try this extension on the English Wikipedia. :) Mheart 19:46, 9 February 2011 (UTC)Reply

Display images in sub-categories

When I view a category, I can see all the image thumbnails (files) for that category. However, when I click on the + to open a sub-category, I only see the file names for that category, not the thumbnails. Is there a way to view the thumbnails here also? --Robinson Weijman 09:44, 12 February 2011 (UTC)Reply

Show pages (mode=all) in Sidebar

Hi, the sidebar option is great however I'd like to show all pages in the tree rather than just the subcategories as normally done by mode=all. Is this possible in the sidebar?

The following line in LocalSettings.php works fine in the sidebar :-)
$wgCategoryTreeSidebarOptions['mode'] = CT_MODE_ALL; # Show pages in the sidebar (not only the categories)--Cornucopia 14:20, 15 November 2011 (UTC)Reply

Namespaces setting not working

I have MediaWiki 1.16.0, and CategoryTree latest stable version r62678. I have 2 namespaces called "KB" and "HowTo", where the article/documents are residing. 2 documents coming from the two namespaces are linked to a Category called Category:SuSe, and from there, that category (SuSe), its linked to Category:Linux.

I want a CategoryTree to only show the articles/documents from the "HowTo" namespace that are linked to the "Category:SuSe". I am trying the following syntax:

< categorytree mode=all namespaces=HowTo > Linux < /categorytree >

The categorytree is defined on a article that I want it to be a "Dashboard" that will show all documents.

But it is showing me documents from both NameSpaces (KB and HowTo) under the Tree. As far as I understand from the documentation, the "namespaces" setting, should restrict it from only showing documents from the namespace I defined, right? Or am I reading it wrong?

NOTE: I tried linking both documents directly to the main category (Category:Linux), and the namespace setting would work. Therefore, leaving to the conclusion that works only at 1 level, but if you make it up to 2 levels, won't work.

Is there any way to make CategoryTree be recursive along all categories, or any kind of hack/workaround? --Diego Ordonez 12:48pm GMT -6 March 10th, 2011

Question

Can anyone tell me how to enable to following line into the categories The number of included categories (C), pages (P) and files (F) is stated in brackets. and display their number with the subcategories? --CenturioST 15:32, 15 March 2011 (UTC)Reply

You will find your answer here 10:42, 25 April 2011 (UTC)

How to show all categories?

I wonder how I can show all categories used on the site. Like this site, but to be able to paste this info in a single page. -- Kristofer, 2011-03-16

I also wonder how to do that simple feature ! There should be an argument like "all" to display all categories... --Varlin 18:14, 8 June 2011 (UTC)Reply

Get rid of + on empty subcategories

Is there a way to get rid of the + sign when there are no subcategories? It's confusing and annoying for visitors...

categorytree-member-num and different languages

Having configured my Wiki like MediaWiki since I wanted to see how many categories, pages and files are in a subcategory, I discovered that it did not work on my account but it workied for everybody else.

The difference is that I changed my language, in preferences, to en-GB - British English.

Apparently it only works in the default language en-English.

78.134.29.242 08:09, 1 May 2011 (UTC)Reply

If you want it to work in all languages you can edit the categorytree-member-num entry in CategoryTree.i18n.php. You can still use parser functions in here as well. Just remember to delete your MediaWiki:categorytree-member-num page or else it will get used instead of the language file. --Matthew.JA 19:34, 13 May 2011 (UTC)Reply

CategoryTree staying opened after going back

We really enjoy this extension so far. Well theres always something. In our case the "problem" is, that after going down in one category and subcategories (depth 5-6), loading the specified category and then hitting the "back" button on the browser (firefox mostly) the tree is folded again. Is there any chance the tree stays opened? Is this more like a feature request? Thanks in advance for all help regarding this ;) --129.233.1.35 12:46, 20 June 2011 (UTC) maikReply

Yep, that's a feature request. I'm also interested in this one as I'm using my CategoryTrees a lot for quick navigation on my wikis. --John Ericson 23:14, 10 January 2012 (UTC)Reply
I am interested in too :-) --Cornucopia (Philippe), 19 January 2012

Hi, I've just upgraded my wiki from 1.16.5 to 1.17.0 and now category tree in the sidebar is not work. It does not contain any one category.

Now ResourceLoader loads JavaScript resources at the bottom of the body(insted in the head at previous versions) and I get the following JS error:

categoryTreeLoadChildren is not defined;
addOnloadHook is not defined .

Sorry for my english. --SimonLitt 16:14, 13 July 2011 (UTC)Reply

You might want to install the MW 1.17 version of CategoryTree, if you haven't already of course, and see if that helps. Cavila 14:02, 3 August 2011 (UTC)Reply
I got this error on CategoryTree-MW1.17-r85033.tar.gz version. And I fix this by replacing line 395 of CategoryTreeFunctions.php to:
scroll|
$html .= 'window.onload=function (){categoryTreeLoadChildren("' . Xml::escapeJsString( $title->getDBkey() ) . '", ' . $this->getOptionsAsJsStructure( $depth ) . ', document.getElementById("' . $load . '").parentNode);}';

--SimonLitt 06:48, 9 August 2011 (UTC)Reply


Thanx Simon, had the same problem and your code fixes it - Daniel K. Schneider 16:17, 16 August 2011 (UTC)Reply

It is still not fixed at CategoryTree-MW1.18-r100383 version. --SimonLitt 06:27, 30 November 2011 (UTC)Reply

CategoryTree and alternative table of contents templates

Recently I reported a problem with CategoryTree which affected the behaviour of MediaWiki categories. With the new version for MW 1.17, that appears to be sorted now (!). However, the TOC templates for categories as used on Wikipedia, such as this one here, don't currently work with CategoryTree. Does anyone know of a fix? Cavila 14:02, 3 August 2011 (UTC)Reply

Never mind, it's neither CategoryTree nor Ajax. It must be something else in MW 1.17 or other extensions may not be compatible. Cavila 08:24, 4 August 2011 (UTC)Reply
Fixed. Cavila MW 1.17, MySQL 5.1.57, Php 5.2.17 10:05, 9 August 2011 (UTC)Reply


Please Help With the Following Error

Why am I getting this error? "Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "CategoryTree::renderChildren". Database returned error "1054: Unknown column 'cl_type' in 'where clause' (localhost)"."

Thank you, -Brad

I am getting the same error. I noticed that this query seems to have gotten no response and i wanted to bump it since i am having the same issue. Also if i try to go to the special page 'categorytree' i get a html error as if the wiki isn't there.

I am using: MediaWiki 1.16.5, PHP 5.3.8 (cgi-fcgi), MySQL 5.0.41-log. I installed the extension and for the moment have not added anything to localsettings except the useajax line and the call to the extension. $wgUseAjax = true; require_once("$IP/extensions/CategoryTree/CategoryTree.php");

--Kay 08:41, 14 November 2011 (UTC)Reply

OK! i got it fixed. Still not sure exactly WHY it was broken but i downloaded the files again. this time being sure to use the download snapshot (rather than subversion) and select 1.16.X and the error went away and everything works like it should.

--Kay 13:52, 15 November 2011 (UTC)Reply

Loop if category is member of itself

If a category is a member of itself you can click on the + and the tree will expand showing the category again where you can click on the + again and so on. A category loop detection would be more elegant --Danwe 13:22, 27 August 2011 (UTC)Reply

Sort your categories & articles with DEFAULTSORT

Hi,

A short post to share a useful tip: Put the following line in your categories and/or articles if you want to sort them differently to the default alphabetic order:

{{DEFAULTSORT:value}}

Where value is a string like 001, abc...

Many thanks for this nice extension :-)

Philippe --Cornucopia 26 September 2011

Formatting does not work

Custom formatting doesn't work in our 1.17.0 Mediawiki, it looks like the entire term is covered in nowiki-brackets or something similar:

Test2 + Test3 + Test4 + Test5

added to the MediaWiki:Categorytree-member-num page is shown as

'''Test2''' + '' Test3'' + <b>Test4</b> + <i>Test5</i>

on every output page of CategoryTree. Guess that shouldn't be the case. --Bzzz 11:15, 29 October 2011 (UTC)Reply

Show pages only

Is it possible to have a mode option for <categorytree> that shows only pages inside category and subcategories, without showing subcategories?--Nickanc 14:20, 30 October 2011 (UTC)Reply

JS tricks

The follow can be done in the JavaScript console like w:Firebug

To open one level of subcategories:

$('SPAN.CategoryTreeToggle[title="expand"]').click()

Keep doing that until it returns zero items, and then all items have been expanded.

To obtain a list of unique pages:

pages = $('A.CategoryTreeLabelPage');
page_hrefs = pages.map(function(){ return $(this).attr('href') });
distinct_page_hrefs = $.grep(page_hrefs,function(v,k){ return $.inArray(v,page_hrefs) === k; });

Then "distinct_page_hrefs.length" will report how many there are. John Vandenberg 05:11, 4 November 2011 (UTC)Reply

Clicking the [+] has no effect, gives a JavaScript error or just sits on loading

Ok so this error is shown under troubleshooting but i don't seem to fit any of the instances listed.. I am not using the categorytree tag in system messages.. it's being used currently on a page where it is the only thing on that page. I double checked and $wgUseAjax = true is immediately before the extension call. I can't use the latest version of the extension. I have mediawiki 1.16.5 and when i use the lastest version, i can't get it to work at all (see the notes i added to the entry about SQL error 1054 I am not using rewrite rules or aliasing.

i checked the special page, i checked a page using the categorytree tag and i checked the actual category pages.. it is the same on all, the + just sits on loading when you click it.

Please help. --Kay 19:19, 15 November 2011 (UTC)Reply

works in version 1.17?

the following error occurs to me: mw.util.wikiScript is not a function anyone help me?

I'm sorry. I was using the wrong version. Problem solved.

--189.59.163.166 19:17, 23 November 2011 (UTC)Reply

[x] instead of [+] for empty categories on MW 1.16.x

What code changes are necessary to make the [+] change to a [x] for empty categories on MW 1.16.x (I have r62678 of this extension) --Luke McKee 15:56, 24 November 2011 (UTC)Reply

When I upgraded to MW1.18, CategoryTree stopped working properly. It showed the initial category tree, but when you click on the + it said 'Loading' but didn't load.

Then I upgraded to the latest version of CategoryTree. Now it doesn't show the + symbols at all.

Help!Jonathan3 23:05, 10 December 2011 (UTC)Reply

Which version is the latest version that you have installed? Badon 04:09, 11 December 2011 (UTC)Reply
The code says it is version 6. The code doesn't seem to say what revision it is, but the one offered today when I choose 1.18 as my MediaWiki version is release 100383. Since my message above, I made a small change as suggested on the CategoryTree page (Extension:CategoryTree#.5Bx.5D .5B.2B.5D .5B-.5D toggles shown only on the first level of the category tree view) which made the +/- symbols show. However, now when I click on the + symbols, it shows 'loading...' but never loads. I have also raised the issue on the MWUsers forum (http://www.mwusers.com/forums/showthread.php?17845-Do-CategoryTree-or-DynamicPageList2-work-with-MW1.18&p=59590#post59590). Thank you very much. Jonathan3 11:20, 11 December 2011 (UTC)Reply
Try the trunk version perhaps (although the 1.18 version really should be fine)? At least some version has to work, since this wiki runs (roughly) 1.18, and category tree is working fine here. Bawolff 18:38, 11 December 2011 (UTC)Reply
Yes, it is very bizarre! It has the same problem using both the {{#categorytree}} parser function, the <categorytree> tag, and in the Special:CategoryTree page. I have tried both the 1.18 version and the Trunk version (the version I used with MW1.16.5 showed an error message on the special page). I have tried commenting out the options in LocalSettings.php. I have $wgUseAjax = true; in LocalSettings.php. I use 'very short URLs' but have an exception for extensions/ the same as for skins/.
Incidentally, the - symbol does work, e.g. when I use depth=2 or depth=3, and after that the + also works (but only for those items that have been hidden by the - symbol).
Any ideas? Thanks Jonathan3 22:03, 11 December 2011 (UTC)Reply

I apologise: it works perfectly fine with the Monobook skin, so must be a problem with the 'GumaxDD' skin that I'm using. When I find out the solution I'll put it here. Sorry again. Jonathan3 22:39, 18 December 2011 (UTC)Reply

*FIXED* The GumaxDD skin has been updated to fix the problem. See http://paulgu.com/wiki/Drop_Down_Menu_Series and http://forum.paulgu.com/viewtopic.php?f=7&t=1016&start=10#p3317 Best wishes Jonathan3 18:36, 31 December 2011 (UTC)Reply

Adding multiple trees

I've seen this question asked in the past, but never found a good answer. So we made our own.

Basically, it's just a matter of defining an array in LocalSettings.php of the trees you want to create. With a little hacking of CategoryTree.php and some defining of system messages in MediaWiki itself, you'll have as many trees as you like. This was developed and tested with MW 1.18 and 1.16.5. See the comments below for more details on how to make this work.

Here's the diff showing the changes that need to be made in CategoryTree.php:

@@ -155,7 +155,7 @@
        global $wgUseAjax, $wgHooks, $wgOut;
        global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeOmitNamespace;
        global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode, $wgCategoryTreeAllowTag;
        global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories;
+       global $wgCategoryTreeSidebarRootArray;

        # Abort if AJAX is not enabled
        if ( !$wgUseAjax ) {

@@ -163,7 +163,7 @@
                return;
        }

-       if ( $wgCategoryTreeSidebarRoot ) {
+       if ( $wgCategoryTreeSidebarRoot || $wgCategoryTreeSidebarRootArray ) {
                $wgCategoryTreeForceHeaders = true; # needed on every page anyway
                $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'efCategoryTreeSkinTemplateOutputPageBeforeExec';
        }

@@ -293,11 +293,27 @@
  * Registered automatically if $wgCategoryTreeSidebarRoot is set to a category
name.
  */
 function efCategoryTreeSkinTemplateOutputPageBeforeExec( &$skin, &$tpl ) {
-       global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
+       global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions, $wgCategoryTreeSidebarRootArray;
+       # Added ability to specify an array of category trees instead of just a single tree.
+       # To use, specify this line in LocalSettings instead of the standard $wgCategoryTreeSidebarRoot:
+       # $wgCategoryTreeSidebarRootArray = array( 'Category:Articles', 'Category:Second_Tree' );
+       # Use your own root categories instead of "Articles" and "Second_Tree".
+       # This will use the same options for all trees.
+       # These category trees will NOT show up in Special:AllMessages.  To label them, go to MediaWiki:categorytree-portlet-(name).
+       # In the above examples, these pages would need to be defined:
+       #  MediaWiki:categorytree-portlet-Articles
+       #  MediaWiki:categorytree-portlet-Second_Tree

+       if ($wgCategoryTreeSidebarRootArray) {
+               foreach ($wgCategoryTreeSidebarRootArray as $wgCatArray) {
+                       $html = efCategoryTreeParserHook( $wgCatArray, $wgCategoryTreeSidebarOptions );
+                       $tree = substr($wgCatArray, strpos($wgCatArray, ":") + 1);
+                       if ( $html ) $tpl->data['sidebar']['categorytree-portlet-' . $tree] = $html; //requires MW 1.13, r36917
+                }
+       } else {
        $html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions );
        if ( $html ) $tpl->data['sidebar']['categorytree-portlet'] = $html; //requires MW 1.13, r36917
-
+       }
+
        return true;
 }

@@ -377,3 +393,4 @@

        return false;
 }


--Jlemley 17:18, 15 December 2011 (UTC)Reply