Extension talk:NiceCategoryList2

Almost Nothing Displays at All
I'm running mw v1.6 with php v4.4.7 and NCL v1 with the include in localsettings.

With code like this: Category:Books then I get a list of the pages in the BOoks category. However, no matter what code I put in, I can't get the ncl to list all the categories. (I only have top level categories BTW).

Has anyone else had this or can anyone suggest anything here? Thanks!.

New option to sort regarding the key
I added a new option to avoid ncl to sort the list alphabetically, to have index key sorting like mediawiki does.

Thanks for your extension of the extension. Jej 10:46, 9 November 2006 (UTC)

Cannot add more than one set of ncl tags
Why can't I add more than one set of tags in a page?

Sarwar (sarwar@metafour.com)


 * It seems to be working for me... maybe try the new version? JohanTheGhost 00:42, 2 March 2007 (UTC)

Broken with 1.9a
I'm running a recently-upgraded 1.9a, and I get this with any NCL listing: UNIQa23a55a20531f14-ncl-00000002-QINU Or something similar anyway. Different everytime I load the page. Not sure what's up, can you perhaps tell me what to fix? &#8465;ilver&#167;&#8465;ide 18:39, 4 January 2007 (UTC)


 * Yup, I've finally run into this myself. I've uploaded a new version which seems to fix it. Cheers, JohanTheGhost 00:36, 2 March 2007 (UTC)


 * Do you have this fix in v1.0 also? I have MW 1.8.3 and recently run into same problem... Thanks! Khitrenovich 11:05, 25 July 2007 (UTC)

Help (mediawiki 1.6,ncl 1.0)
I've installed the code[includes....] in my localsetting.php, and upload the version 1.0 in extensions. And when i put category:... , it display the category listing when I modified the page but when I saved, it isnt display anything.(sorry for my bad english) Idon't understand.--Add 02:23, 19 June 2007 (UTC)


 * I don't know why that would be, but it sounds like a cache issue.... edit it again, and do "Show preview" -- does the list appear? And when you save again, what exactly is displayed? JohanTheGhost 15:23, 20 June 2007 (UTC)


 * I have already test that, but when I do "Preview" it display correctly the category, but when i save it display "nothing", a blank. I have put require_once("$IP/extensions/NiceCategoryList.php");, maybe if I change it to require_once($IP."/extensions/NiceCategoryList.php"); but I thing that it's no importante.I test and i post if it anything changed.--Add 02:26, 21 June 2007 (UTC)


 * The only thing I can think of is that another extension may be interfering with it. Someone recently had a similar problem with the SelectCategory extension.  Do you have other extensions installed?  What happens if you disable them (comment out the "require_once" lines from LocalSettings)?  JohanTheGhost 14:51, 21 June 2007 (UTC)



MediaWiki: 1.6.10 PHP: 4.4.3-dev (cgi-fcgi) MySQL: 5.0.37 Extensions:

* Special pages: o Edit Count, Gets the edit count of a user, by Benjamin Peterson o MakeBot, Special page allows local bureaucrats to grant and revoke bot permissions, by Rob Church * Parser hooks: o CharInsert, Allows creation of JavaScript box for inserting non-standard characters, by Brion Vibber o Edit Count, Gets the edit count of a user, by Benjamin Peterson o MultipleUpload, Allows users to upload several files at once., by Travis Derouin o NiceCategoryList, generate a category page showing all pages in a category, including subcategories, by Kichik o Sort, Simplify the creation of sorted lists., by Rob Church * Other: o Newuserlog, adds a log of account creations to Special:Log, by Ævar Arnfjörð Bjarmason

style=compact not working?
Hi,

Great extension! Im fairly new to MediaWiki but would really like to use your extension. I installed it but for some reason when I specify the style=compact option nothing shows up. If I used the style=bullet option it works, but I'm really after that nice compact look :(

Im running php5, MW 1.10. Tried NiceCategoryList version 1 but still no luck. Any idea?

Thanks again

Cheers


 * Weird. I just upgraded my test wiki to 1.10, and style=compact works fine for me; in fact, it's the style I use for my main index.  Here's the exact code (it's in a template which I include in category pages):

Category:
 * Try these exact parameters; if there's some parameter combination which doesn't work, let me know, and I'll try to fix it. Otherwise, all I can suggest is that you have some strange conflict with another extension you have installed.  Try temporarily disabling them one by one to see if you can find which one is causing problems? JohanTheGhost 15:50, 5 July 2007 (UTC)
 * I'm having the same problem.
 * These are my extensions :
 * CategoryTree
 * Contributors
 * Duplicator
 * NiceCategoryList
 * ParserFunctions
 * Google Maps Extension (version 0.7.7)
 * I've tried and switched them of, but no change.
 * MediaWiki: 1.10.1, PHP: 5.2.3 (cgi-fcgi), MySQL: 4.1.11-Debian_4sarge7-log
 * --Luc Verhelst 12:56, 10 August 2007 (UTC)


 * Yes, I am also having the same problem. All parameters work except for style=compact. --Magick 09:42, 4 September 2007 (UTC)

style=compact and headings=bullet working together
JohanTheGhost: style=compact and headings=bullet don't quite work together if you have categories which have non-category siblings. For example, if you have a category 1, and you have 1.1 and 1.2 under 1, but you also have an articles X and Y under category 1, then NCL2 renders something like this:
 * Category 1
 * Article X • Article Y


 * Category 1.1
 * Category 1.2
 * Notice that the articles introduce a newline before the subcategories. MediaWiki thinks this means that the subcategories are not part of the category list, and puts two bullets in front of Category 1.1. You can solve this by doing, e.g.,


 * Category 1 :Article X • Article Y
 * Category 1.1
 * Category 1.2
 * Doing this without breaking the other layout types looks a little annoying, though.
 * Follow-up: I think I fixed that bug, plus made "style=bullet headings=bullet" work properly in the situation where categories and articles are siblings. I posted my changes as version 2.1.

Allow for parser syntax
This is a great extension. However, I was trying to use it in a template and ran into an issue that the template arguements were not getting parsed by the extension. This is typical for non parser-style extensions. I have made the modifications to your code, v2.0. See below

Broken with 1.10.1?
Sorry to bother you. I'm having a strange problem with NCL2 and mediawiki-1.10.1 that I'm hoping you can help me with. I've used the following code in a page:

Category:Universal Foundation

However, it shows up like this:

UNIQ645602511ba5a312-ncl-00000002-QINU

Any ideas what I'm doing wrong? Perhaps it's the new version of mediawiki.

Thanks! Ben

Compact Style, Bullet Headings
When I used the combination of "compact" for style, and "bullet" for headings, I didn't like the way it put large "heading" type listings of the individual articles together on one line. Obviously, I wanted them on one line (that's why I chose compact for the stye), but didn't like the large headings.

To change that, I took the following code (beginning at my line 400):

and added an elseif as shown below

I'm not a programmer, just a network guy. I don't know how well this will work with other combinations, but it did just what I wanted on my system. If someone with better programming skills wants to look at this and clean it up some so it works seamlessly for others, have at it.

--Herb Parsons 17:47, 7 December 2007 (UTC)

Show All Categories
I have a relatively small site with < 100 categories and a maximum expected depth of 3 or 4. Is it possible to list all categories without first forcing the categories into a single category?

Tnabtaf 00:11, 29 January 2008 (UTC)

Busted under mw 1.12 - Failed to create title!
the use of the parser (which afaik is pretty much for generating html from wiki markup) can cause a problem if the parser is appending NewPP limit info in a little html comment to the string passed in....which happens to be the category name you specified.

the resulting string of course doesn't match any categories, and you'll just get a message that says it 'Failed to create title!'

I'm sure there's a simple way to tell the parser not to add the NewPP info comment, but since my experience with mediawiki code and php is approaching about 1 hour now I just modified this extension to strip off the comment if it's there. Look in the code and find:

replace it with:

I assume if/when someone fixes this "properly" this entire blurb can get whacked

Failed to create title!
NCL seems to be broken. I get "Failed to create title!" all the time. Even Category:Scripts does not work. NCL V1.0 works, but V2.0 should work as well w/ mediawiki 1.12.0rc1. Visus 13:12, 2 April 2008 (UTC)

Stale Content / Extension Doesn't refresh
I ran into a nasty problem with this extension: every time you changed what category something was in, you had to re-edit the page with the tags in it, and even worse, sometimes the page itself would disappear for no good reason, with a re-edit necessary to see it again! The only suggestion I got was to change $wgParserCacheType to CACHE_NONE. However, this just made the whole page disappear, and not come back even after a re-edit. I scoured other extensions, and I think I found the solution. Just add this code to the extension:

in the hookNiceCategoryList function, add this near the top: $DisableCache = true;

And later on in the same function, after fetchCategoryLinks is called add these line: if ($DisableCache) { global $wgVersion; $dbr =& wfGetDB( DB_SLAVE ); # Do not cache this wiki page. # for details see http://public.kitware.com/Wiki/User:Barre/MediaWiki/Extensions global $wgTitle, $wgDBprefix; $ts = mktime; $now = gmdate("YmdHis", $ts +120); $ns = $wgTitle->getNamespace; $ti = $dbr->addQuotes($wgTitle->getDBkey); $version = preg_replace("/^([1-9]).([1-9]).*/", "\\1\\2", $wgVersion); $sql = "UPDATE $wgDBprefix". "page SET page_touched='$now' WHERE page_namespace=$ns AND page_title=$ti"; $dbr->query($sql, __METHOD__); }

As you can see, I borrowed this fix from another extension, but as far as I can tell, it works great!

Language problems
Got a rather simple problem, I dont know what the top Category is in my language (Danish). For some reason, some tags are translated, while others are not.... how do I figure the correct replacement for "Category:Category"? --Asset 17:44, 18 July 2008 (UTC)

Conflict with Terminology extension ?
Does anyone have the same issue ? when activating terminology extension on my MW 12 then I can use the NCL tag only once in a page, all the rest of the page is ignored... Help... :)

Thanks Doc

Does not work with Konqueror
The Monospace layout is strongly disturbed on pages with NCL. See www.opus-info.org

Thanks for your help. Gabuzo 10:58, 14 November 2008 (UTC)

skipping images
I don't like images to turn up in my pagelist. To exclude images (my default), I added some code.

Org:

New (added line 183):

And changed

to look like this (starts at my line 389, added 2 extra if's)

hear say: “I'm not a programmer, just a network guy. I don't know how well this will work with other combinations, but it did just what I wanted on my system. If someone with better programming skills wants to look at this and clean it up some so it works seamlessly for others, have at it.” (qoute Herb Parsons)

wiki font size changed after installed NCL2
In IE8, font size become larger and the login page becomes blank(the login input box and it's title text does not appear). When I clikc "Compatible Mode", the login page returns normal, but the size is still incorrect.

The NCL version is 2.2.

123.112.62.102 02:22, 18 March 2009 (UTC)

Incompatible with MediaWiki 1.13.2?
Hello, I've installed NiceCategoryList on MediaWiki 1.13.2, but no subcategories are displayed. I am using NiceCategory List 2.2. Is this a known issue?

Stefan

working only for logged-in users
I'm using NCL2.2 on MW1.14 and some strange things happen. NCL behaves correctly if a user is logged in into the wiki, but it does not display the tree if a mere visitor passes by this page: http://wiki.piratenpartei.de/Kategoriebaum now I'm puzzled how to debug this behaviour. --Jamasi 12:30, 15 June 2009 (UTC)

Categories are available twice
Hello, I implemented this extension on my website and it works fine in general, but: I put tags in one of Category: pages and I can see the subcategories list from NCL extension, but I see original Mediawiki list of subcategories below. Is it possible to fix via extension or should I write my own hack ? Thank you in advance.

Vadim

Some update for this Extension
This update will allow you to choose how many article to show on the list. Settings will include an object name 'number'. Default, 'number'=0. It's mean all articles in the Category will be shown. If 'number' != 0, number of article(s) will be shown is 'number', randomly. If Articles's count < 'number', all article(s) will be shown.

For example: Category Name Add an option to settings: Show randomly 'number' of articles:

Using this for category pages
How would I use this extension or something similar for the category pages in MediaWiki? I don't want the alphabetical ordering that MW provides automatically.

Hiding the Section Edit link
When I use the Magic Word, the page previews without showing the Section Edit links for the sections generated by the extension. But when I save the page, it renders the Section Edit links. I have tried putting the magic word on various places on the page with no succes. Is there any way around this?

This is happening in Mediawiki 1.15.1 with the simplest use of the extension:
 * Category:Software

Does not work in my configuration
It doesn't work in the following configuration (Windows 7 64-bit, running MoWeS):

MediaWiki: 1.15.0 PHP: 5.3.0 (apache2handler) MySQL: 5.1.35-community

Absolutely nothing shows up even when using the simpliest tag.

Paragraph Spacing on Multiple Lists is Too Big
When I enter 2 ncl tags, one after the other - there is 66 pixels of vertical space seperating the 2 lists instead of just a normal paragraph worth of space. This is an example of what I entered:

Sony Products Samsung Products

You can test this on my page http://feedbackwiki.org/wiki/Reviews:Forza_3 by editing the page. Is there a setting where I can change the paragraph spacing between lists or is there some CSS I can add?

Paragraph Spacing after every output
In the source-code on the page I found this after the output of NCL2:

p>

The following code shows the separation. p>

How can I avoid this??

--Red Garfield 08:09, 29 July 2010 (UTC)

Extension:NiceCategoryList2 v2.3
I have updated the extension to use CSS styles and fixed some minor issues, like the duplicated list bullets. For now, you can find the updated extension page at User:*Surak*/Extension:NiceCategoryList and the code at User:*Surak*/Extension:NiceCategoryList/2.3. Since this is a major change, I did not activate it (extension templatemode=nocats), and I did not dare to save it in your extension namespace. Do you allow me saving it there, or do you suggest a different way to handle this? Thanks in advance, --Surak&Delta; 13:11, 28 May 2011 (UTC)

Enable template argument parsing in tags (e.g. )
According to http://www.mediawiki.org/wiki/Manual:Tag_extensions, since MW 1.16alpha (r55682), text within tags can be parsed within extensions, making template arguments expanding possible. However, this feature is not built into the NCL extension as of Sep 2011.

The good news is, you only need to change 2 lines to achieve that.

Original code in the extension PHP: public function hookNcl($category, $argv, &$parser) { // Get any user-specified parameters, and save them in $this->settings. $this->settings = array_merge($this->settings, $argv);

Change the code to: (pay attention to the extra 4th argument from the function definition   public function hookNcl($category, $argv, &$parser, $frame) {        $category = $parser->recursiveTagParse( $category, $frame );        // Get any user-specified parameters, and save them in $this->settings.        $this->settings = array_merge($this->settings, $argv);

Enjoy.

User:Ewcy - 13 Sep 2011

Selectively show wiki links to Category pages
It would be great to be able select whether the Categories / headings showed up as flat text or wiki links, regardless of 'style' setting. Although I can't find it documented anywhere, it seems that it will always wiki link Categories in "compact" style, but never in "Bullet" style. Another option such as  could be used to control this behaviour.

I've hacked this feature in as per the diff below, but have never touched PHP before so I'm sure someone could do better. Would love to see a feature like this in the next release.

148a151 >    'linkcats'  => 0, 345a349 >        $disp    = $this->settings['linkcats'] ? $link : $title; 349c353 <                $output .= "" . $title. ""; --- >                $output .= "" . $disp. ""; 352c356 <                $output .= "\n* ". $link. "\n "; --- >                $output .= "\n* ". $disp. "\n "; 134.159.154.133 07:58, 8 February 2012 (UTC)

Proper indentation for nested lists.
As http://ddowiki.com/page/Deathblock for an example, how can I make the ncl listing indented properly under the "found on" section? Currently it looks like: When I would like to have it show up as: -- ShoeMaker  ( Contributions &bull; Message )   02:51, 2 February 2013 (UTC)
 * Found on:
 * This item
 * That item
 * Poor item
 * Found on:
 * This item
 * That item
 * Poor item

extension:Translate fix and fixed two errors in the code.
The code had NiceCategoryList2 as an installation directory and the instructions states that the extension should be installed in .../extensions/NiceCategoryList, so I fixed that in the code.

I also added a check so that the HTML headings can't increase beyond 6.

if($heading > 6) { $heading = 6; }

There should be a more elegant solution, but at least that one doesn't print wrong HTML.

If you are interested in using the extension with extension:Translate you can do the following changes to the code:

If you want the list to print Translate links, change

To

in function outputCategory($category, $level = 0).

That only works for the compact list. If you want MyLanguage links to for instance the normal ... list, you should ctrl+f and replace all "[[:" with "[[Special:MyLanguage/".

If you don't want to show all the translated pages in the list (you shouldn't, the MyLanguage link handles the language for you) you can add a regex check to function getCategoryLinks($dbr, $title).

I hope someone finds this useful :)

Sanelith 2013-08-07 16:57 UTC

Changes to Categories not reflected on page reload.

 * MediaWiki: 1.21.2
 * PHP: PHP 5.3.10
 * NCL: 2.2.3 (2011-05-01)

This comment: Caveat: When used in a template, the category list will not refresh immediately when reloaded; edit and save the article to see updates. Appears to apply when in a page or template regardless. Is there a fix? One should not have to edit/save pages using the tag to refresh the list. It should be dynamic. --Achowe (talk) 17:01, 7 October 2013 (UTC)

Prev / Next Links Idea
I'm writing an 'ordered' category on a wiki and thought that along with including the category list, having previous/next links would be a very useful addition. I added a few lines to track previous/next articles while generating the list, and then draw links to them as part of the output.

class NiceCategoryList { ... private $lastlink = ''; private $prevlink = ''; private $nextlink = ''; private $currenttitle = '';

...

public function hookNcl($category, $argv, $parser) { $this->currenttitle = $parser->getTitle; ... # generate the category listing $output = " ". $this->outputCategory($catData). " ";   $output .= " Prev: $this->prevlink "; $output .= " Next: $this->nextlink ";

...

function outputCategory($category, $level = 0) { ...   foreach ($articleTitles as $link) { ...     if( $this->lastlink == $this->currenttitle ) $this->nextlink = $title; if( $title == $this->currenttitle ) $this->prevlink = $this->lastlink; $this->lastlink = $title;

And finally in CSS, to make the category list appear at the bottom (bit of a hack, must be a better way): div.ncl-next                      { position: absolute; bottom: 40px; }

How to show pages in a specific namespace?
I want to show pages either in a specific category and a namespace, how to do?

NiceCategoryList2/2.3 works on Mediawiki 1.25, PHP 5.6.9 with some changes
Files on GitHub

Serge3576 (talk) 06:51, 12 September 2015 (UTC)