3

Situation

I retrieve data from a CSV-source using the external data-extension for mediawiki:

{{#get_web_data:url=http://example.com/names.txt|format=csv|data=name=1}}
{{#display_external_table:template=AddCat|data=1=name }}

The file names.txt simply contains names, one per row.

The template AddCat simply adds the first parameter as category: [[Category:{{{1}}}]]

Problem

The page I use this template on actually shows the name-categories on its bottom but the page itself is not visible on the category-page (I ran the jobs of course).

I assume that this has something to do with the fact that the category-name is not present in the wiki-text but is fetched from an external source.

Any suggestions how I can really add the categories?

user2033412
  • 1,950
  • 2
  • 27
  • 47

2 Answers2

1

The extension has been extensively re-factored since you posted this quesion. The current version adds the page to the categories, in your example, immediately; I've checked.

I recommend that you upgrade the extension and MediaWiki.

Alexander Mashin
  • 3,892
  • 1
  • 9
  • 15
0

Have you looked in CategoryHook?

CategoryHook to which you can add auto-categorisation rules to LocalSettings.php (after including CategoryHook.php--see #Installation). Following is an example which adds articles to Category:Articles containing trees if they have any {{#tree:...}} parser functions in their content.

$wgHooks['CategoryHook'][] = 'wfCategoriseTrees';

function wfCategoriseTrees(&$parser,&$text,&$categories,$sortkey) {
    $categories['Articles containing trees']
        = array(preg_match('/\\{\\{#tree:/i',$text),$sortkey);
    return true;
    }

There are several extensions, you may want to try this one

UnP
  • 108
  • 14
  • 1
    I haven't. But I think this will have the same problem: The page itself does not contain the relevant text at any place. Only after fetching the data from the webservice the text is known and probably therefore the categories aren't "really" added. – user2033412 Dec 19 '18 at 08:36