Page MenuHomePhabricator

Bug? Namespaces Parameter Fails on Extension:CategoryTree
Closed, ResolvedPublic

Description

(on external mediawiki, not MediaWiki.org)

TOC tree works fine on my site, gunretort.xyz: returns all categories and pages. This works, no prob:

{{#categorytree:TOC|hideroot|mode=pages}}

Extension doc says:

a list of namespaces from which pages should be shown in the tree (since rev:36864, July 2008). The entries in the list must be namespace names, separated by spaces. The main namespaces can be represented by "-" or "0". This overrides the mode option.

But, none of these work-- i get an empty tree:

{{#categorytree:TOC|hideroot|mode=pages|namespaces=Main}}
{{#categorytree:TOC|hideroot|mode=pages|namespaces=-}}
{{#categorytree:TOC|hideroot|mode=pages|namespaces=0}}
{{#categorytree:TOC|hideroot|namespaces=Main}}
{{#categorytree:TOC|hideroot|namespaces=-}}
{{#categorytree:TOC|hideroot|namespaces=0}}

Is there a fix?

@Duesentrieb

Event Timeline

Johnywhy created this task.Apr 10 2018, 5:59 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 10 2018, 5:59 PM
Johnywhy renamed this task from Namespaces Parameter Fails on Extension:CategoryTree to Bug? Namespaces Parameter Fails on Extension:CategoryTree.Apr 10 2018, 5:59 PM

Please provide exact MediaWiki version information and exact extension version information. Thanks!

Stryn added a subscriber: Stryn.Apr 10 2018, 7:20 PM

The documentation also says that "This may be overridden by the use of the namespaces option". So if you use the namespaces option at the same time, the mode option loses it's purpose.

Why you get no more results than the "Welcome" page (see preview https://gunretort.xyz/index.php?title=Welcome&diff=next&oldid=911) for the following codes is that it's the only page that doesn't come through a subcategory, it's directly in the "TOC" category. So in the other words, only page directly in the main namespace (not through categories).

{{#categorytree:TOC|hideroot|namespaces=Main}}
{{#categorytree:TOC|hideroot|namespaces=-}}
{{#categorytree:TOC|hideroot|namespaces=0}}

I hope you understood, and also possible that I misunderstood something.

Johnywhy added a subscriber: Tacsipacsi.EditedApr 11 2018, 1:50 AM

@Stryn Thx for your reply. @Tacsipacsi found the solution, below...

The documentation also says if you use the namespaces option at the same time, the mode option loses it's purpose.

True, but i think the issue here is not really related to mode.

Why you get no more results than the "Welcome" page is that it's the only page that doesn't come through a subcategory, it's directly in the "TOC" category. So in the other words, only page directly in the main namespace (not through categories).

You're on the right track re categories, but you didn't give the solution :)

Here's the solution:

"Category" is a namespace. When you don't use the namespaces parameter, then "namespaces=Category" is implied.

But, when you use "namespaces" parameter, then "namespaces=Category" is no long implied. Thus, when you use the namespaces parameter, if you want subcategories to show up in the result, then you must include Category in namespaces:

Example:

{{#categorytree:TOC|hideroot|namespaces=Main Category}}

"Main" above returns the content pages. "Category" returns the category-pages.

The "mode" parameter is disabled by the "namespaces" parameter-- the default mode is pages. This makes sense, because if you don't want pages, then the namespaces parameter isn't relevant: the default "Category" is the only namespace you need. Thus, you can achieve categories mode by leaving out "namespaces" and leaving out "mode=categories". Subcategories will appear, but not pages.

{{#categorytree:TOC}}

https://www.mediawiki.org/wiki/Topic:Uayg5i6zzycif75q

Notes added to the Extension documentation:
https://www.mediawiki.org/wiki/Extension:CategoryTree#Notes_on_the_'namespaces'_parameter

(what's the issue with links on Phabricator????)

(what's the issue with links on Phabricator????)

What's the vague "issue with links" that is referred to? In general, see https://www.mediawiki.org/wiki/Phabricator/Help for help.

TTO added a subscriber: TTO.May 9 2018, 2:15 PM

It's great that you found a solution to your problem, but what's the actual issue that you would like dealt with in this task? If everything is now OK we can just close this task.

Johnywhy closed this task as Resolved.May 9 2018, 4:49 PM