Topic on Extension talk:Auto Create Category Pages

Using parserfunctions in created pages

5
2001:9E8:E3F5:EC00:589E:8FD1:40CE:FAA3 (talkcontribs)

Hi everyone,

i'm trying to use a parserfunction from Extension:CategoryTests for my Autocreatecategorypages-stub template and it's not working in auto created pages, but it does work if i insert the template manually.

The idea is that i have a template which adds a specific category to newly created pages. When these categories are created, i want to check if the creating page (page name == category name in this specific case) is inside another specific category and, if so, add a specific parent category to the created category page:

This is the category {{{page}}}.

<includeonly>{{#switchcategory:#page={{{page}}}|Cat1=[[Category:ParentCat1]]|Cat2=[[Category:ParentCat2]]|Cat3=[[Category:ParentCat3]]}}</includeonly>

The text part is working as expected, but the categories are not. Are the tags a problem? Do i have to escape the category names inside of the function somehow?

Thank you all in advance!

2001:9E8:E3F5:EC00:589E:8FD1:40CE:FAA3 (talkcontribs)

Hi, me again, I don't know what happened to the "tags" up there, it looked fine in the preview. I meant if the tags are a a problem.

And i should have mentioned, this is what MediaWiki:Autocreatecategorypages-stub looks like:

{{Autocreatecategorypages-stub|page=$1}}

FreedomFighterSparrow (talkcontribs)

The documentation says "Parameters: $1 - page title", but the actual code actually inserts the title of the category page. I have no idea why that is - as you could just use {{pagename}} instead of hard-wiring the page name, but it looks to be like that in the original code, way before I started maintaining it. Not my fault, I tell you! :-) But seriously, I'm not sure what's the right thing to do here - while I could add a second parameter with the originating page's title, your use case doesn't sound very common and obscure features are almost never a good idea.

2001:9E8:E3F9:5C00:948A:EC39:2F98:BD32 (talkcontribs)

So it actually inserts "Category:CategoryName", did i get that right? If so i may be able to work around that, don't know how yet, but knowing the exact ouput of $1 is definitely helpful. Maybe consider adding it to the documentation? :)

Thanks a lot!

FreedomFighterSparrow (talkcontribs)

It actually just inserts "CategoryName", without the category prefix. I updated the on-page documentation to reflect that.

Reply to "Using parserfunctions in created pages"