From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
Release status: unmaintained
SelectCategoryTagCloud v1.0.png
Implementation Page action
Description Adds a category selection tag cloud to the edit and upload pages and enables a Google Suggest-like/typeahead completion of categories entered by the user.
Author(s) Andreas Rindler
Latest version 1.4.2 (2011-02-27)
MediaWiki 1.10.0 - 1.16.0
License No license specified
Download download
$wgSelectCategoryNamespaces $wgSelectCategoryRoot
Translate the SelectCategoryTagCloud extension if it is available at translatewiki.net
Check usage and version matrix.

The SelectCategoryTagCloud extension provides five functions:

  • It shows a tag cloud of all categories (unless limited by minimum count or by a custom root category)
  • It strips all categories linked within a page upon editing and inserts them in a category input box.
  • It adds categories selected from the tag cloud to the input box and removes them if already there.
  • It suggests existing categories that match the user input in the input box from the database via AJAX
  • It saves the categories from the input box to the text body of the page on saving.

For an overview of the extension also see the author's blog post on Open Spaces.

To see the extension in action, see MIKE2.0.


Please see the below pages for further documentation:


Copy the SelectCategoryTagCloud directory into the extensions folder of your MediaWiki installation. Then add the following line to your LocalSettings.php file (near the end):

 require_once( 'extensions/SelectCategoryTagCloud/SelectCategoryTagCloud.php' );



The tag cloud parameters are configured at the top of SelectCategoryTagCloudFunctions.php. (These are going to be moved to LocalSettings.php in a future release.)


Configure the database details for the AJAX server page at the top of SelectCategoryTagCloudSuggest.php. Because this is a basically a standalone webpage that is not included in any MediaWiki php pages, it doesn't have access to the configuration details in LocalSettings.php (which would include the database details).

This functionality has been replaced with the Mediawiki built-in AJAX framework.
--Lindele 17:27, 1 April 2008 (UTC)



This is in the SelectCategoryTagCloud.php file

Defines in which namespaces the Extension should be active.

All namespaces are already predefined in the array. Set a specific namespace to true to enable or to false to disable the extension.

Active per default are: Media, Main, Project, Image, Help, Category.

 $wgSelectCategoryNamespaces[NS_PROJECT] = false;
 $wgSelectCategoryNamespaces[NS_CATEGORY] = false;
 $wgSelectCategoryNamespaces     = array(
        NS_MEDIA                => true,
        NS_MAIN                 => true,
        NS_TALK                 => false,
        NS_USER                 => false,
        NS_USER_TALK            => false,
        NS_PROJECT              => true,
        NS_PROJECT_TALK         => false,
        NS_IMAGE                => true,
        NS_IMAGE_TALK           => false,
        NS_MEDIAWIKI            => false,
        NS_MEDIAWIKI_TALK       => false,
        NS_TEMPLATE             => false,
        NS_TEMPLATE_TALK        => false,
        NS_HELP                 => true,
        NS_HELP_TALK            => false,
        NS_CATEGORY             => true,
        NS_CATEGORY_TALK        => false


Set a specific root category depending the namespace. Only categories within this root will be displayed when editing a page in a certain namespace.

Useful on big wiki sites to keep the database load down.

If not set (default) the extension searches for all root categories and displays them including all children.

  $wgSelectCategoryRoot = array(
       NS_MEDIA                => false,
       NS_MAIN                 => "My Article Root Category",
       NS_TALK                 => false,
       NS_USER                 => false,
       NS_USER_TALK            => false,
       NS_PROJECT              => false,
       NS_PROJECT_TALK         => false,
       NS_IMAGE                => "My Image Root Category",
       NS_IMAGE_TALK           => false,
       NS_MEDIAWIKI            => false,
       NS_MEDIAWIKI_TALK       => false,
       NS_TEMPLATE             => false,
       NS_TEMPLATE_TALK        => false,
       NS_HELP                 => false,
       NS_HELP_TALK            => false,
       NS_CATEGORY             => false,
       NS_CATEGORY_TALK        => false


Defines if the extension should be active when editing subpages.

 $wgSelectCategoryEnableSubpages = false;

vcxvv vbvb bfff

To Do[edit]

  • Move SelectCategoryTagCloudSuggest.php configuration for database access into Mediawiki framework to simplify configuration --Completed, Lindele 17:27, 1 April 2008 (UTC)
  • Move configuration of tag cloud parameters from SelectCategoryTagCloudFunctions.php into LocalSettings.php
  • Test i18n features
  • Fix a bug : Adds a line break before each <nowiki> tag for each time the page is edited,


Version 1.2[edit]

  • Modified SelectCategoryTagCloudSuggest.php to remove extra } at end of file
  • Modified SELECT statement to ignore case of search terms
  • Changed trim() function (4x) to rtrim() in SelectCategoryTagCloudFunctions.php to allow for leading spaces to create sections on the page

Version 1.3[edit]

  • Removed SelectCategoryTagCloudSuggest.php file and moved functionality to Mediawiki AJAX framework
  • Improved typeahead display
  • Fixed bug "not recognising categories with a . (dot) in the name"
  • Clicking outside the suggest div removes the div that is displaying the suggestions and frees up the view on the tag cloud
  • Categories are not lost on "Preview" anymore, but stay in the input box

Version 1.4[edit]

  • Minor bug fixes
  • Moved to omCollab (SVN)

Version 1.4.2[edit]

  • Small fix to enable PHP 5.3.x

Document issues on Extension talk:SelectCategoryTagCloud. Alternatively, you can reach me at - Andreas Rindler: <mediawiki at jenandi dot com>

Feature Requests[edit]

  • the extension automatically detects which categories are already associated with this article and inputs them into the Category field.
  • the extension automatically detects which categories are already associated with articles linked to this article and inputs them into the Category field.
  • Allow Exclusion of subcategories. So for example, if we wanted to exclude all countries within Asia (i.e. sub-categories of Asia) from the Tag Cloud, we simply specify the top-level category Asia as the exclusion starting point (all categories 1 level below are left out of the tag cloud).
  • add support for sqlite databases (current implementation is hardcoded for mysql)
  • add support for PostgreSQL or use a suitable Database Abstraction Layer

See Also[edit]