Extension talk:CategoryTree

Jump to navigation Jump to search

About this board

Archives 

1 (2006/2007) - 2 (2008) - 3 (2009) - 4 (2010) - 5 (2011)

Is there a "folder icon" alternative format for CategoryTree

2
GregRundlett (talkcontribs)

I'd like to use "folder" icons for categories, and mime-type "page" icons to mimic a file browser instead of the small triangles of CategoryTree. Does such an option exist, or does anyone know of an implementation that does so? Something like this jQuery plugin

87.190.56.226 (talkcontribs)
Reply to "Is there a "folder icon" alternative format for CategoryTree"

Split a long list into Multi-Column Lists

3
Samuel Goujon (talkcontribs)

Hi all,

Would it be possible to split a long list into multiple horizontal columns?

For example, every 50 categories, a new list is created on the right (keeping the alphabetical order)

Thanks for your help!

Cmjohannes (talkcontribs)

I would also like to know if this functionality is possible. I have a category with 300 member pages, which I would like to display on my main page. Currently, the CategoryTree extension displays one page per line. I would like to use a four or five column table to improve site aesthetics and make the list more readable.

Something like:

<table>

<tr><td>Page A</td><td>Page B</td><td>Page C</td><td>Page D</td></tr>

<tr><td>Page E</td><td>Page F</td><td>Page G</td><td>Page H</td></tr>

</table>

Where/how could/should such display output be implemented?

5.29.23.15 (talkcontribs)

Use template:columns from wikipedia. Just put the categorytree inside the template:columns.

Reply to "Split a long list into Multi-Column Lists"

Download list of subcategories without explicit implementation?

1
137.44.100.2 (talkcontribs)

Hi, I apologise if this may sound silly but I have just come across this category tree which seems very handy but I need just lists of categories and subcategories (like an xml/ json file) as opposed to a visual API of the tree. I realise I could use this API and gradually construct my own list but would ideally like to not have to spend time implementing this if there is a faster route.

I have also come across pywikibot which is suggested below for downloading pages with specific categories, but I am needing to download a lot of pages that fall under the categories "science" and "technology" so a bot is not the best option (I am currently working with the wikidump data: enwiki-20170820-pages-meta-current.xml.bz2 (25.86gb))

Reply to "Download list of subcategories without explicit implementation?"

New Instructions are Confusing and Unclear

3
Johnywhy (talkcontribs)

this instruction is incomplete and confusing:

"if [when??], then mode=pages will be used. It means that if the site configuration hasn't been changed [changed in what way?], the following are equivalent (site configuration may affect the third one)"

Extension:CategoryTree#Notes on the 'namespaces' parameter

Previously, the notes said "otherwise... otherwise... otherwise". Three "otherwise" in sequence is confusing. I attempted to improve with bullets. Meaning is still unclear.

Tacsipacsi (talkcontribs)

I found only one otherwise, which means, as always in English, “if none of the above are true”. Of course it’s incomplete if you change it to “if [when??]”. I tried to clarify the site configuration change.

Johnywhy (talkcontribs)

Thx.

Reply to "New Instructions are Confusing and Unclear"
Johnywhy (talkcontribs)

the tree still shows deleted pages.

Johnywhy (talkcontribs)

Tree shows old version of renamed page.

Any fix?

thx

Reply to "How to force refresh?"

force categorytree to update when add new page.

10
Summary by Sarise298
Siggiae (talkcontribs)

I am invoking categorytree with the syntax {{#categorytree:Embryo|mode=pages|showcount|depth=2 etc. When I create a new page and add it to the category Embryo, categorytree will not list the new page. I can close/open the page that invoked categorytree, login again with no effect. If I look directly at the page Category:Embryo the new member page is listed immediately. The only way I can get the {{#categorytree:Embryo etc to update is to resave the page where it occurs. Same behavior if I use the tag syntax.

There must be a better way, I thought this function was dynamic. No obvious warnings of this behavior on the relevant help page or in discussions. Suggestions?

91.192.31.192 (talkcontribs)

I'm also seeing this. shouldn't it populate the tree automaticly?

178.251.183.178 (talkcontribs)

yes it should make the tree grow even tho right not my tree isnt growing

SmartK (talkcontribs)

We would also like to know if there is a "fix" for this. I have noticed that updates of pages and categories are shown in categorytree with a long time difference. Maybe we have to run some kind of job to update the database in the background? I can reproduce this with mediawiki 1.27.0.

79.122.187.86 (talkcontribs)

I confirm the issue too. MW 1.27.1

Dturtill (talkcontribs)
Dturtill (talkcontribs)

There is a possible temp fix for this if you disable Caching for your wiki then they change instantly to do this add the following at the bottom of your LocalSettings.php file.

$wgEnableParserCache = false; $wgCachePages = false;

Johnywhy (talkcontribs)

thx for that, could be useful for other things!

but, doesn't seem to fix CategoryTree...

This post was hidden by FDMS4 (history)
Reply to "force categorytree to update when add new page."
Johnywhy (talkcontribs)
Ciencia Al Poder (talkcontribs)
Reply to "How does ifeq work?"

How to Restrict CategoryTree to a Particular Namespace?

9
Summary by Johnywhy

"Category" is a namespace. So, when you use the namespaces parameter, you must include Category in namespaces, if you want subcategories to show up in the result.

Example:

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

If you don't include the namespaces parameter, then "namespaces=Category" is implied.

The "mode" parameter is disabled by the "namespaces" parameter, but you can achieve categories mode by leaving namespaces blank. Subcategories will appear, but not pages:

{{#categorytree:TOC|namespaces=}}

hideroot works as expected.

.

Notes added to the Extension documentation:

Extension:CategoryTree#Notes on the 'namespaces' parameter

and

Extension:CategoryTree#When i use the namespaces parameter, i don't get any pages

Johnywhy (talkcontribs)

Re gunretort.xyz

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}}
Tacsipacsi (talkcontribs)

Of course you get an empty tree, as Category:TOC is empty. I works for me with an existing category.

Johnywhy (talkcontribs)

TOC isn't empty

Tacsipacsi (talkcontribs)

Just click on the red link above. It’s completely empty. (If you use another wiki, where it’s not, you should mention it. This extension works perfectly on this wiki.)

Johnywhy (talkcontribs)

For gunretort.xyz

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

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

The problem is `namespaces=Main` doesn't work. None of these work:.

{{#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}}

@Duesentrieb

Tacsipacsi (talkcontribs)

The first one (namespaces=Main) works for me using the API (I haven’t tested the other ones). I used the API because I can’t test using the normal edit interface, as anonymous users cannot edit pages. (Please note that some security software may warn for possible XSS (cross-site scripting) attack for the above URL. It’s because of the curly brackets in the wikicode, and the page is absolutely safe to visit.)

Johnywhy (talkcontribs)

Thx for testing. I see your url is:

https://gunretort.xyz/api.php?action=parse&text={{#categorytree:TOC|hideroot|mode=pages|namespaces=Main}}

It brings up a page of raw json. I notice that it only contains the word "Welcome". It doesn't show any of my subcategories or pages.

I tried your syntax on a wikipage

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

Again, the result is just the word "Welcome", which is the only page in the top-level TOC category. It does not have an assigned namespace: https://gunretort.xyz/index.php/Welcome

Other pages are in sub-categories of TOC, with no assigned namespace. They don't appear in the tree. Shouldn't they?

This syntax shows all sub-categories, all pages:

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

Clue: Extension doc says "namespaces" parameter: >"This overrides the mode option." It's unclear what "override" means. But it seems it actually disables subcategories.

I performed another test: i created a page in the TOC category, and the "Published" namespace. I also moved a different page to Published namespace, in a subcategory. We get only the page in the top-level TOC category, Published namespace. More evidence that 'namespaces' parameter ignores subcategories.

{{#categorytree:TOC|namespaces=Published}}
Tacsipacsi (talkcontribs)
Johnywhy (talkcontribs)
Johnywhy (talkcontribs)

Doc says

> "to drop your own wikitext article into the Sidebar, and then add CategoryTree items to it...."

  • What does that mean? What "article"? i thought we're talking about a tree. Do they mean a link to an article?
  • What does "add items" mean? I thought the point of the tree is that all items are automatically added.

> If you want the CategoryTree on a different position in the sidebar, you can reference it on MediaWiki::Sidebar as "categorytree-portlet"

  • tried that. It just gave me a link to a non-existent page called "Categories".

> To append a link "CategoryTree" to your toolbox (sidebar) add following code to the javascript-page...

  • Huh? All that javascript just for a link to category tree? But i want the whole tree.

> Add these lines to LocalSettings.php:

  1. > $wgCategoryTreeSidebarRoot = 'Category:article_name';
  2. > $wgCategoryTreeForceHeaders = true;
  • Again-- unclear. What's the point of a tree, if we're only putting one article in the sidebar?
  • Where are the parameters in above instructions? If i've worked out a set of parameters that gives me the exact tree i want, how do i apply those parameters to a tree in the sidebar?
Reply to "Problems Adding Tree to Sidebar"

Hook to run function and allow changing value of $wgCategoryTreeSidebarRoot

1
Ksumwalt (talkcontribs)

I want to have two values for $wgCategoryTreeSidebarRoot, one for when a user is logged in and a second for anonymous users. This would allow for a limited list in the sidebar for anonymous users when using the categorytree-portlet. I should be able to create a function in localsettings.php and link it with a hook function but can't figure out what hook to use and get the value changed. Any suggestions?

Reply to "Hook to run function and allow changing value of $wgCategoryTreeSidebarRoot"