Extension talk:CategorySuggest
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)
[edit] 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 .
[edit] 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.
[edit] 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
[edit] 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
[edit] 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 <nowiki> 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 <nowiki> 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)
[edit] 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)
[edit] 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)
[edit] 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)
[edit] 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, <nowiki> causes bad page processing, categories dropped on preview, leading spaces are removed), there's a few other things that came up:
- adds a space after a </nowiki> tag for each time the page is edited,
- adds a line break before each <nowiki> 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 <includeonly> and <noinclude>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 & ;),
- 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?
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)
- 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)
[edit] 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:
//CONFIGURE WITH YOUR LOCAL CREDENTIALS mysql_connect("localhost", "USERNAME", "PASSWORD"); mysql_select_db("DBNAME"); $wgPrefix = ''; //MediaWiki database prefix you selected during install
to:
//CONFIGURE WITH YOUR LOCAL CREDENTIALS mysql_connect("$wgDBserver", "$wgDBuser", "$wgDBpassword"); mysql_select_db("$wgDBname"); $wgPrefix = ''; //MediaWiki database prefix you selected during install
- 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)
[edit] 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).
[edit] 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;...
[edit] Internationalisation problems
Very nice extension and quite good until now, even if the bug with <nowiki> 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égorie (tag) pour cet article.'; $messages['categorysuggest-boxlabel'] = 'Catégories'; $messages['categorysuggest-taglabel'] = 'Catégories populaires';
[edit] Problematic with Templates
it tricky to use with <includeonly> and <noinclude> 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 <includeonly> and <noinclude> 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)
[edit] 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 UCASE() (used in CategorySuggest.php:65) only available in MySQL, the equivalent in PostgreSQL is UPPER.
Another issue with PostgreSQL:
PHP Warning: mysql_real_escape_string(): A link to the server could not be established in /CategorySuggest/CategorySuggest.php on line 52.
In CategorySuggest.php:52 the code is
$searchString = mysql_real_escape_string($query);
Exists any equivalent in PostgreSQL?
TESt—“‘«‹›»’”
[edit] 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)
htmlentities(implode(";", $arrExistingCats), ENT_QUOTES))
[edit] 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:
-
-
-
- categories that are on the page are not shown in the dialog. Which further means:
- 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)
[edit] 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:A]] [[Category:B]] [[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
[edit] 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:
$messages['categorysuggest-instructions'] = '<ul> <li>To add one category, just type it and select it from the list.</li><li>To add more than one category, add a semicolon ";" after the last category, and then continue typing the desired category and select it from the list.</li><li>To add a subcategory, add a vertical bar "|" after the main category name and type the subcategory name.</li></ul>';
and then on CategorySuggest.body.php, line 61 add
$m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorysuggest-instructions' ). "</p>\");\n";
--Fladei 19:27, 26 May 2011 (UTC)
[edit] 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)
function fnCategorySuggestAjax( $query ) { $wgCategorySuggestNumToSend = '10'; if(isset($query) && $query != NULL) { $searchString = $query; # % and _ are not escaped so do it here $searchString = str_replace( '%' , '\%' , $searchString ); //$searchString = str_replace( '_' , '\_' , $searchString ); //$searchString = str_replace( '|' , '%' , $searchString ); $dbr =& wfGetDB( DB_SLAVE ); $categorylinks = $dbr->tableName('categorylinks'); $page = $dbr->tableName('page'); $sql = "SELECT DISTINCT\n". " cl_to AS cats\n". " FROM $categorylinks\n". " WHERE\n". " UCASE(convert (cl_to using latin1)) LIKE '".$searchString."%'". " LIMIT $wgCategorySuggestNumToSend"; $res = $dbr->query( $sql ); $suggestStrings = array(); for ( $i=0 ; $row = $dbr->fetchObject( $res ) ; $i++ ) { array_push($suggestStrings,$row->cats); ## Optional enhancement: Cutoff and rollover at max number of suggestions ## implement cutoff and rollover here # if ($i > 10) { # array_push($suggestStrings,'More...'); # break; # } } $text = implode("<",$suggestStrings); $dbr->freeResult( $res ); } if ( !isset($text) || $text == NULL ) { $text = '<'; } $response = new AjaxResponse($text); return $response; }
[edit] 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
$finaltext .= '<nowiki>' . $nowikitext . '</nowiki>';
Change line 182 to be
$finaltext .= $cleanedtext;
Change line 209 to be
$m_cleanText .= preg_replace( "/{$m_pattern}/i", "", $m_textLine )."\n";
Add at line 226
$m_cleanText = substr($m_cleanText,0,strlen($m_cleanText) - 1);