Extension talk:CategorySuggest/Archive

Fixed version available for MediaWiki 1.18 (2012-02-23)
Hello all, I have updated this extension to support MediaWiki 1.18 and added a few usability improvements:


 * automatic delimiter insertion
 * keyboard access for selecting from search results
 * fixed case-insensitivity in search

https://github.com/middlebury/CategorySuggest

I'm not sure what the policy on taking over projects is, but I'd be happy to help maintain improvements to this extension (using Github for source and issue-tracking) if the original author has abandoned this project. Feel free to contact me at afranco@middlebury.edu.

--Adamfranco (talk) 16:19, 23 February 2012 (UTC)

it does not work in Mediawiki 1.18
With PHP 5.3: Detected bug in an extension! Hook fnCategorySuggestOutputHook has invalid call signature; Parameter 2 to fnCategorySuggestOutputHook expected to be a reference, value given

--> Can be fixed when you modify OutputPage.php from $parserOutput to &$parserOutput and EditPage.php (Line 877) $this to &$this

it does not work in Mediawiki 1.16
errormessage: Warning: Parameter 2 to fnCategorySuggestSaveHook expected to be a reference, value given in ...\includes\Hooks.php on line 133

thanks for help --Trailer 06:38, 13 July 2010 (UTC)

it works with php 5.2.8, not with php 5.3 --Trailer 08:36, 27 September 2010 (UTC)

is there any possibility to get this extension work on mediawiki 1.16 with php 5.3 ??? are there amy other similar extensions? selectcategorytagcloud has an error with german language and the tagcloud is much to big on our wiki.

it does not work in Mediawiki 1.15
Opps.. it doesn't seem to work in mediawiki 1.15 anymore. the error message: Warning: Parameter 2 to fnCategorySuggestOutputHook expected to be a reference, value given in D:\xampp\htdocs\wiki\includes\Hooks.php on line 117.

Strange behavior in Mediawiki 1.12
For Mediawiki
 * Product 	Version
 * MediaWiki 	1.12.0
 * PHP 	5.2.5 (apache2handler)
 * MySQL 	5.0.51a

When I edit an article, category frame is missing (see below)

Then after a showpreview, it's OK

Have you an idea how the issue could be fixed ? Thanks in advance

CKL

I get the same problem in MediaWiki 1.13.2 using CategorySuggest version 1.1

KMc

Remove space on a blank line
CategorySuggest extension removes spaces in a blank line.
 * This is for example annoying to display source code
 * For example

Source code Line 1 Source code Line 2 (1 Space at the beginning of the line) Source code Line 4

will give Source code Line 1 Source code Line 2

Source code Line 4

Possible Bug with NoWiki tags
I created a few articles that ranged in length from 18 to 35,000 characters on a private wiki I set up on my own server using MediaWiki 1.11. I realized afterward that I needed to add some  tags to parts of the article to make it look right. The only problem is that after saving with these tags, when I go back and try to edit the articles again, I get this error: "Fatal error: Call to undefined function fnajaxsuggeststripcats in /home/deepspac/public_html/aaronmatthias/extensions/CategorySuggest/CategorySuggestFunctions.php on line 170" At the current moment I don't have FTP access nor access to my webserver control panel, so I haven't tried disabling the extension yet. Any thoughts or suggestions??? --Ds093 15:06, 15 November 2007 (UTC)


 * I have the same error message as soon as  tags are in an article. I use Mediawiki 1.11.0 and CategorySuggest 1.0 --Alex 10:42, 27 November 2007 (UTC)
 * solved: I checked the code and it looks like a typo in CategorySuggestFunctions.php. Please replace line 170 with the string below --Alex 11:04, 27 November 2007
 * $cleanedtext = fnCategorySuggestStripCats($regulartext,$arrAllCats);

Updated the code, thanks, Lindele 18:03, 10 March 2008 (UTC)

Suggest portion not showing?
I also am not seeing the Category Suggest portion showing up.
 * Same here. I have MediaWiki: 1.11.0 PHP: 5.2.5-tuxtools (cgi) and MySQL: 4.1.22 -- 141.30.75.108 13:11, 27 November 2007 (UTC)
 * You should both check if category suggest is correctly installed on Special:Version. Beside that, the portion only shows up in edit mode. --Alex 18:36, 30 November 2007 (UTC)

Previewing the changes
Would it be possible to make a patch where the categories that are currently written in the box don't get dumped when the article changes are previewed? I wind up having to copy and paste the category list every time on my Wiki each time I preview the page. 68.219.84.74 03:12, 21 December 2007 (UTC)

Completed, Lindele 18:03, 10 March 2008 (UTC)

Removing categories!
I installed this on Mediawiki 1.11 and while it adds a category to an article, if you preview it the categories go blank and when it is finally saves all the categories (new and old) are deleted. I think this may be a product of having to enter a captcha before saving.

Preformatted text problem.

I found a problem with preformatted text. When I click edit on a page with preformatted text, the leading spaces got trimmed. Looks like the $m_pageObj->textbox1 = trim( $finaltext ); line in CategorySuggestFunctions.php is causing problem.

We've encountered the same problem (categories were deleted from page at preview). A solution to this problem is very much appreciated.

I don't understand the problem. Can you please explain further? Lindele 18:03, 10 March 2008 (UTC)

List of issues
Andreas, there's a lot of interest in CategorySuggest where I work as a way of getting categories on pages. Unfortunately, in addition to the issues noted above (error in code,  causes bad page processing, categories dropped on preview, leading spaces are removed), there's a few other things that came up: Are you still working on this extension? It seems that not parsing the page and adding the categories client-side (like the toolbar) could get rid of a number of problems. --JaredM 20:50, 15 February 2008 (UTC)
 * adds a space after a < /nowiki> tag for each time the page is edited,
 * adds a line break before each  tag for each time the page is edited,
 * Tried to solve this, but haven't found a solution yet. Any suggestions are welcome.Lindele 18:03, 10 March 2008 (UTC)
 * it tricky to use with and tags, (perhaps there should be a user preference to turn it off, so they can prevent pages being parsed)
 * Can you explain further, please? Lindele 18:03, 10 March 2008 (UTC)
 * categories with characters other than spaces, letters and numbers are not found on the page (e.g. ".", "-"),
 * category lookup is case-sensitive,
 * hard to use with | to reorder categories
 * Any suggestions are welcome, Lindele 18:03, 10 March 2008 (UTC)
 * even if it doesn't use the API for queries, it should use the mediawiki database access functions rather than embedding the database user and password in the script,
 * the path to the javascript file could be a variable that could be set in localsettings.php,
 * sometimes does not show categories that have just been added (caching issue),
 * does not look up categories including some special characters when you type them (e.g. &),
 * inserts some special characters in markup format (e.g. & becomes &amp ;),
 * form should be created by javascript extension so it is not presented to users without javascript,
 * Soeren notes that the suggestions are currently sent with no charset specified,
 * should it make use of the Ajax library?
 * this extension seems to disable the special:allmessages function: the page comes up blank

I have moved most items to the To Do list, please check it out. Thanks for collecting this extensive list. Lindele 18:03, 10 March 2008 (UTC)

Passing SERVER, USERNAME, PASSWORD, DBNAME and DBPREFIX
Posted by --AuroraCA 18:46, 9 March 2008 (UTC)AuroraCA

I don't understand why the CategorySuggestSuggest.php needs to be edited to enter the server, USERNAME, PASSWORD, DBNAME and $wgDBprefix when these are specified by the variables $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword and $wgDBprefix in LocalSettings.php. Are these not passed or can they not be passed to CategorySuggestSuggest.php?

The code for CategorySuggestSuggest.php could be changed from:

to:


 * The current implementation does not make use of the internal Ajax library. So the file CategorySuggestSuggest.php is called directly from the browser as part of the Ajax call.  LocalSettings.php is not called by the procedure, so it has no idea of the MediaWiki globals.  --JaredM 12:44, 10 March 2008 (UTC)

Completed (replaced with internal AJAX function, hence, this configuration and the file itself are obsolete), Lindele 18:03, 10 March 2008 (UTC)

Style not being applied
I was having a problem where the stylesheet css was not being loaded and therefore the box not being styled correctly. To fix this issue, I changed $wgHooks['OutputPageParserOutput'] in CategorySuggest.php to $wgHooks['BeforePageDisplay'] and removed the second parameter from fnCategorySuggestOutputHook in CategorySuggest.body.php.


 * Excellent, thanks! This solved numerous problems for me (using MediaWiki 1.13.1).

How to specify multiple categories?
How do I select multiple categories? Is there any seperator character?

Alain le Sage (212.178.122.3 13:56, 18 June 2008 (UTC))

I have the exact same question, hopefully someone still notices this. --DaPete 15:43, 3 April 2009 (UTC)

=> ";" does the trick, no space, just category1;category2;...

Internationalisation problems
Very nice extension and quite good until now, even if the bug with  are still a bit problematic for me...

On Frenche, Category is replaced by Catégorie and this is a source of problems for me. I looked at the code, tried to replace the line 198 of CategorySuggest.body.php, but it didn't worked...

$m_pattern = "\[\[({$m_catString}|category):(.*)\]\]";

One other problem is that I'm not allowed to enter UTF characters like "é" in my i18n.fr.php file...

You may use html entities instead ;)

Translation of CategorySuggest.i18n.php into french : $messages['categorysuggest-title']	= 'CHOIX DES CATEGORIES (tags)'; $messages['categorysuggest-subtitle']	= 'Veuillez saisir le nom d\'une cat&eacute;gorie (tag) pour cet article.'; $messages['categorysuggest-boxlabel']	= 'Cat&eacute;gories'; $messages['categorysuggest-taglabel']	= 'Cat&eacute;gories populaires';

Problematic with Templates
it tricky to use with &lt;includeonly&gt; and &lt;noinclude&gt; tags, (perhaps there should be a user preference to turn it off, so they can prevent pages being parsed)
 * Can you explain further, please?

One example that might help; I'm writing a template that has different categories depending upon if it is included in a page or viewed as a template so I want categories inside &lt;includeonly&gt; and &lt;noinclude&gt; tags but this extension keeps stripping them out. The only solution I have found so far is disabling the extension while I create this template. It would be better to have it disabled on Template pages or, as the original poster suggested, allow the user to turn off the extension when they want.
 * Has there been and development on this issue? I am interested in any sort of solution.--Siadsuit 13:12, 27 September 2010 (UTC)

CategorySuggest for Postgres
This category don't run on mediawiki 1.12 (and 1.13, 1.13.1) + postgres 8.1. I have saw that it call mysql function in the code.

The function was  (used in CategorySuggest.php:65) only available in MySQL, the equivalent in PostgreSQL is.

Another issue with PostgreSQL:

In CategorySuggest.php:52 the code is

Exists any equivalent in PostgreSQL?

TESt—“‘«‹›»’”

Problem if category has apostrophe
Big problems with support for categories that have apostrophes.

Fixed by wrapping category output in htmlentities (CategorySuggest.body.php:62)

Per Section Editing
Bug: suggests categories on pages which already have categories when author is making per section changes. Using MW 1.13.2 and CategorySuggest 1.1 (2008-03-10) --Robinson Weijman 14:18, 27 July 2009 (UTC)


 * I'm amazed there have been no responses to this. Has anyone else seen it?  This is a critical error to me.  --Robinson Weijman 15:34, 15 February 2010 (UTC)


 * maybe this is not really a problem, because categories only work for a whole page, not for a section? So if you enter an additional category this should not be a problem, right? Raimund 16:16, 17 February 2010 (UTC)


 * Thanks for the reply. The problem is that:


 * 1) categories that are on the page are not shown in the dialog.  Which further means:
 * 2) if the user again enters the same category (in per section editing) then the page will show the same category twice (when page editing - not when viewing).

The solution (I think) is simple: when per section editing, show which categories are present. --Robinson Weijman 12:49, 18 February 2010 (UTC)

Category markup in the list when 3 or more categories
Bug: with the current implementation, the category list gets messed up with Wiki markup if there are more than 2 categories. For instance:

[[Category:C]]

is displayed as:

A]] [[Category:B;C

Solution: change the regexp line 201 in CategorySuggest.body.php as follows $m_pattern = "\[\[({$m_catString}|category):(.*?)\]\]"; (new is the question mark after the asterisk. this makes it non-greedy) --User:moloch timur lenk

How can I change the Category suggestion Text?
"CATEGORY ASSIGNMENT Please enter the name of a category for this article." How can I change the Text above the Category-Box? Raimund 16:21, 17 February 2010 (UTC)

I would like to edit this too, to include instructions on how to add multiple categories Helen 28 April 2010
 * I added the following line to the CategorySuggest.i18n.php file:

and then on CategorySuggest.body.php, line 61 add --Fladei 19:27, 26 May 2011 (UTC)

Add max results and fix capitalization problem
Nice plugin but too many bugs unfortunately. This code will fix capitalization problem as current code attempt at being case insensitive is broken and only picks up categories that are full caps The second part of the fix is limiting the number of results returned. Macsux 21:46, 4 March 2010 (UTC) --

NoWiki new line bug
This code will solve the issue of new line being added before nowiki each time page is saved. There was also other formatting issues associated with it that I think I hammered out. There should be no wikitext changes around nowiki blocks now

Change line 177 to be

Change line 182 to be

Change line 209 to be

Add at line 226

Other comments
it's nice ,we hope the new version can like this Extension:ManageCategories,i think this extension is better.

hmmm it works for category inserting and retrieving. however, I dont see a the category preview with this extension I tried it on MW1.11 and MW1.93 both Firefox and IE6 fail to do this.

the extension on itself is quite nice I have to say User:Dynasource

The preview of Mediawiki doesn't show category links. There is nothing I can do. Lindele 18:03, 10 March 2008 (UTC)