Extension talk:CategorySuggest

From MediaWiki.org

Jump to: navigation, search

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)

Contents

[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) CategorySuggest Wiki 1 12 img01.jpg

Then after a showpreview, it's OK CategorySuggest Wiki 1 12 img02.jpg

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 &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?

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.

[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)