From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status experimental

ImplementationTemplate:Extension#type Special page
DescriptionTemplate:Extension#description AJAX-enabled category filter and browser
Author(s)Template:Extension#username Dmitriy <questpc@rambler.ru> (QuestPCtalk)
Latest versionTemplate:Extension#version 0.3.1 (September 2010)
MediaWikiTemplate:Extension#mediawiki 1.14, 1.15, 1.16
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download from local mirror Template:WikimediaDownload/svn
ExampleTemplate:Extension#example see [1] (available in Russian)


Hooks usedTemplate:Extension#hook

Translate the CategoryBrowser extension if it is available at translatewiki.net

Check usage and version matrix.

CategoryBrowser creates a drop down list of categories. The amount of subcategories, pages or files can be filter and modified to make custom filters.

Technical details[edit]

CategoryBrowser creates special page which implements AJAX-enabled category filter and browser for MediaWiki. Categories can be filtered with pre-defined conditions selected from drop-down list. Every condition contains comparsion operators, which allow to filter the amount of subcategories, pages or files the category should have, logical operators and brackets. Selected condition can be edited with JavaScript-based interface to make custom filters. Custom used-defined category filter is stored in user's cookie for future use. Categories also can be filtered by first letters in their names, optionally with case-insensitive search (implemented for utf8 tables, also may be too slow for large wikis).

AJAX category tree browser shows subcategories of currently "expanded" category, very similar to Extension:CategoryTree, but also shows pages and files as well. Categories, pages and files are browsed via the pager (with limit count), to reduce the system resource consumption in large lists.


  • download the latest available version and extract it to your wiki extension directory.
  • add the following line to LocalSettings.php
  • check out Special:Version and Special:CategoryBrowser page to verify the installation
  • if there are any problems, make sure you've installed successfully and MediaWiki version is compatible with the extension. Please report the bugs at the talk page. Also you may try using previous version (if available).


Currently, an extension has the following available settings to setup:

Place one or more of the following lines below the "require_once" line:

CB_Setup::$categoriesLimit = 10;

to set the limit (amount) of categories per page equal to 10.

CB_Setup::$pagesLimit = 10;

to set the limit (amount) of pages per page equal to 10.

CB_Setup::$filesMaxRows = 2;

to set the files pager to display maximum 2 rows in image gallery.

CB_Setup::$imageGalleryPerRow = 2;

to set the files pager displayed image gallery 2 images per row (default value is 4).

CB_Setup::$imageGalleryPerRow = 0;

to disable usage of image gallery (files pager will be identical to pages pager).

CB_Setup::$allowNestedParents = false;

to disable browsing of category parents (reverse browsing) (since v0.3.1).

CB_Setup::$allowNoParentsOnly = false;

to disable a checkbox for optional selecting of categories which has no parents only (since v0.3.1).


Go to Special:CategoryBrowser special page either by typing its URL in browser address line, or by clicking the same link at Special:Version or Special:Specialpages. The special page screen is divided into the following parts:

  • Category filter form, which has three subsections:
    • Top section has drop-down selector which allows to choose category filter condition either from the set of pre-defined ones, or from previously edited condition (stored in cookie). Also this section of form has "Search for category by name" field which allows to filter categories by first letters of the titles. This section is visible by default.
    • When the condition filter was selected, two form sections with condition editor are also displayed. Middle section of the form shows currently selected condition filter divided into separate operators (condition line). Bottom section of the form displays "sample" operators to be modified and copied into the middle section, to create a used-defined condition filter (samples line).
  • Category tree section, which displays categories matching the filter selected. When category has subcategories, click at the [+] sign displayed before it to expand it contents. Click "Pages" and "Files" links to display pages and files belonging to the selected category, respectively.

User-defined condition filter editing[edit]

Changing parameters of comparsion / logical operators are performed by directly altering input values in condition line. Another operations are performed by choosing small control buttons below the operator. Move the mouse cursor over the desired operator either in condition (middle) or in samples (bottom) line to display the operator's control buttons.

  • To move current operator left, press [<-] control button in condition line. Operation will be performed only when the result does not produce invalid condition.
  • To move current operator right, press [->] control button in condition line. Operation will be performed only when the result does not produce invalid condition.
  • To delete current operator, press [x] control button in condition line. Operation tries to remain validity of condition line (for example, removing matching brackets; when removing condition operator, remove logical operator just before).
  • To copy a new operator to clipboard, press [+] control button in samples line. The copied operator will be displayed in blue color. To clear the clipboard, press the same button twice.
  • To paste an operator from clipboard before current operator, press [+] control button in condition line. Operation will always be allowed in the first and the last position of the condition line. Otherwise, editor's script will try not to allow to create invalid condition filter.
  • To quickly copy/paste new operator from sample line to last position of condition line, press [>+] control button of the desired operator in samples line.
  • To erase the whole condition ("select all"), press [=] control button of "All" operator in samples line.
To apply the newly created filter, press "Apply" button.
When the created condition is invalid, the erroneous operator is being shown in red / aquamarine colors. Also, "apply" button is disabled.


Release Notes
0.2.0 tgz First public release. Although still alpha, I've put enough of efforts to debug it, so it should be usable at least.
0.2.1 tgz Fix patchwork messages. Refactoring of MVC. Separate settings for amoung of items per page in different pagers.
0.3.1 tgz Many bugfixes. Optional browsing of parent categories (reverse browsing). Optional selection of categories which has no parents.

To extract tgz archive in Windows, free 7zip program can be used.


More setup options. Implement different representations / layouts of pages / files view (skins?). Use the parameter of special page. Parser function.

Websites Using[edit]