Extension talk:NiceCategoryList

I've started using this extension on our (internal) wiki. It's great, but I found a bug which outputs category titles as =title= (where title is the category name) if the category has no items (only sub-categories, for example). I fixed it by changing line 139 from: $output =  to: $output = . "\n"; I've modified the code below to include this fix, hope that's Ok. Thanks for a great extension!

--Dflock 12:04, 2 November 2005 (UTC)

Of course it OK. Thanks for the fix!

--Kichik 20:33, 3 November 2005 (UTC)

Really great extension! Thanks. I added the slight changes for my mediawiki 1.4 : the table 'page' was called 'cur'. I don't know when the name changed, I suppose it was in 1.5

--Iubito 08:15, 6 November 2005 (UTC)

Yep, 1.5. Thanks for the update!

--Kichik 20:31, 10 November 2005 (UTC)

Namespace Problem
Thanks for this extension - it's very helpful!

I am encountering one bug though -- I'm using 1.5. When I use this extension for a category that includes pages from different namespaces, it just returns the page names but not the namespace in front, so something like "Wikipedia:Page" becomes simple "Page". This results in a lot of broken links. Does anyone know how I can fix this?

Thanks!


 * Thanks, fixed. The title and display name were mixed up. --Kichik 22:35, 22 November 2005 (UTC)

Limit number of articles in each category
Great extension!

Is there any way to


 * set maximum number of articles in categories that are being displayed?
 * not display articles in categories (only display categories and their subcategories)

It'd be a great automatic indexes/navigation if we can do so

And a category name will link to its category, so that people can click and get to each category, and see all article in that specific category

--Mtha 21:41, 6 December 2005 (UTC)

okie, i got the category link :)

LOOK FOR $output = $heading. $title. $heading. "\n"; REPLACE BY               $output = $heading. "" . $title . "". $heading. "\n";

--Mtha

Another thing
It works great. But How do I get rid of the default subcategory list shown by media wiki? Pgunda 20:02, 13 December 2005 (UTC)
 * Just add the NCL to a page OTHER than the category page itself - if you are working with add the NCL to Skills and link to it instead. Voila. 66.58.239.135 01:36, 20 March 2006 (UTC)

TOC and heading values
How can I set a starting value of heading? I don't want my subcategories to show up as h1 and then start decreasing in value. I'd like to be able to set a value for the heading size to start at. --Anonymous 16:29, 28 January 2006 (NZST)
 * Replace this:

$heading = str_repeat('=', $level);
 * with this:

$heading = str_repeat('=', $level + 1);
 * That help? Making it a parameter would be a tad harder, but this should fix it for now. 66.58.239.135 01:40, 20 March 2006 (UTC)

Image display?
Wow, this was exactly what have been looking for. Except I was hoping images within a category would be displayed as a gallery, or at least as thumbs without bullets. Can this be done? Thanks again.

Alternative Display of Images
The way images are currently displayed caused us problems as we have some large images that ruin the overall flow of the list. Rather than remove these images from the category I made the following change.

Replace the line (line 151 in my copy) $output .= "* " . $disp . "\n"; with if ($link->getNamespace == NS_IMAGE) {     $output .= "* " . $disp . "\n"; }  else {     $output .= "* " . $disp . "\n"; } This renders an image as a link to its image page, rather than displaying the image itself inline. I don't know if perhaps I should be checking for NS_MEDIA aswell.

Almost a gallery
I did want to show all the images in the category but not at their full size. This is what my code looks like (only 3rd line changed): if ($link->getNamespace == NS_IMAGE) {     $output .= "250px|" . $disp . "\n"; }  else {     $output .= "* " . $disp . "\n"; } The third line specifies that all images should be shown, not in a list and have a maximum size of 250 pixels. It almost looks like a gallery (what I actually wanted but this looks good to). --GrandiJoos 15:30, 19 August 2006 (UTC)

Compatibility with MediaWiki v1.6.3
Thanks for what appears to be a great extension! I am not having any luck getting this to work with version 1.6.3 though. I have included it in my LocalSettings.php and it seems to be loading, but when I try to use it it doesn't work. The tag is ignored and treated as text. Does anyone have any suggestions? Does this extension work in v1.6.3? Thanks! UPDATE - - Please ignore my ignorance. The extension works fine in version 1.6.3. I had included it with an include_once statement and it would not work that way. Once I changed it to a require_once statement all is well. Many thanks for this excellent extension!!

"Enhanced" version
Hi, I've made a version of ncl which has several configuration options, giving you a variety of display styles, max recursion depth, etc. I think it's basically backwoards compatible with the current version. So, should I update this extension, or would you rather I make it "NiceCategoryList2" or something? Cheers, and thanks for the inspiration! JohanTheGhost 21:08, 25 May 2006 (UTC)
 * Here's a copy of the new version, which now has a proper page at www.mediawiki.org. JohanTheGhost 15:36, 14 May 2007 (UTC)

Category list does not automatically update
I have noticed that the listing does not automatically update when using the extension

Q: Does it not update at all or does take some time to update? Pamima 21:46, 25 June 2006 (UTC)

It is not updating at all.

Any solution for this?

Setting $wgParserCacheType = CACHE_NONE; seems to work, but seems like a bit of a brute-force approach... any better suggestions?

Q: I have the same problem but the thing with the cache type doesnt work :(

- suggest you try forcing your browser to clear its cache as well - typically CTRL-F5.

Cannot have more than one NCL per article
I really love this extension, and also the extended version. In both versions I have a problem adding more than one NCL per article with MediaWiki 1.6.x. Only the last one displays correctly, all previous ones show something like UNIQ66c9cb59112bf5d6-ncl-878d75ec82358500000001-QINU where the 0000001-QINU changes to 0000002-QINU, 0000003-QINU, etc. with each additional NCL

Anyone know why this is, and know how to fix it?

thanks!

--jonathan

Fix for the UNIQ thing
I think that this is a new thing with MediaWiki 1.6.5+ and extensions which use $wgOut->parse behaving like this. The fix is to do what it says on the mediawiki extensions FAQ. I've fixed this on my local wiki by changing the hookNiceCategoryList function to this:

function hookNiceCategoryList($category, $params, $parser = null) { if (!$parser) $parser =& $GLOBALS['wgParser']; $dbr =& wfGetDB(DB_SLAVE);

$title = Title::newFromText($category); if (!$title) return '';

$ct = fetchCategoryLinks($dbr, $title);

$output = $parser->parse(outputCategory($ct), $parser->mTitle, $parser->mOptions, true, false); return $output->getText; } HTH, Dflock 14:22, 6 July 2006 (UTC)


 * Thanks Dflock, I've been getting this same error with an extension of my own. In general, the part to change is, instead of using

global $wgOut; $output = $wgOut->parse($stuff_to_parse); return $output;
 * one should use

$output = $parser->parse($stuff_to_parse, $parser->mTitle,           $parser->mOptions, true, false); return $output->getText;
 * Is that right?
 * Socoljam 18:46, 23 July 2006 (UTC)


 * I've run across this problem in my enhanced version of this extension. I've managed to fix it, and I think it works better now... the issue is with re-using the parse method of any parser.  To get around this, you need to create a new Parser object for each call to parse.  Check the code to see the fix. JohanTheGhost 00:40, 2 March 2007 (UTC)

Newbie
Sorry, I just donwload and install mediawiki, its runs great. Could someone point me out how to install this feature ? I just want to my Categories listing not to be splitted alphabetical. thks!

Better compatibility with the MW Category namespace
This is a very cool extension, although I have some issues with making it compatible with the way MW ordinarily works with categories : (I'm running 1.6.8)

--MortenB 14:09, 25 July 2006 (UTC)
 * It would be great if this extension could be integrated more smoothly with the way MW categories normally work. For instance, to elect NOT to display the MW category listings if is in place on a category page. Yes one can move the ncl to a new page, but this will break with keeping things within the category namespace.
 * It is a bit confusing that page links are added at the top of the page, if included, and not after the appropriate subcategories. In our wiki, for instance, you get a whole bunch of page links at the top, instead of the hierarchical view of subcategories in place first.
 * Pages in a wiki may well be included in the category displayed, as well as in several subcategories. How can one, if possible, avoid repetitions, when pages are in both main and/or up to several sub categories? For instance, if subcategory *wikis* is in subcategory *webpages*, and pages in *wikis* are also in *webpages*, they wind up as repetitions in the category listing of *internet services*, which includes both subcategories. I guess the local solution to this (and the above point) could be to add pages to just fewer categories, but this will spoil backlinks to the *greater* categories from individual pages in the wiki (which I think is preferable to navigation in general).
 * Could the original and expanded version of this extension be combined to a new official extension compatible with MW 1.6 and 1.7? It's a bit confusing to pick up the bits of fixes around the places, not knowing whether they were written for 1.5 or 1.6, and makes troubleshooting difficult.

1.7.x
please update for 1.7.x

Category sorting key
It seems the category order with ncl does not rely on the sorting key ->

Whatever, thanks for this great extension. Jej 10:04, 9 November 2006 (UTC)

I answer to me...

To let mediawiki to sort the categories, juste change this code :

function sort { usort($this->links, "titleCmp"); usort($this->categories, "categoryCmp"); }

to

function sort { return; usort($this->links, "titleCmp"); usort($this->categories, "categoryCmp"); }

I added this feature as an option in the second version of this extension proposed by User:JohanTheGhost

Jej 10:34, 9 November 2006 (UTC)