Forum:Conditional categorization

There are 2 categories of characters on my wikia:
 * Samurai Pizza Cats Characters. The page is added to this category if contain Template:SPCCharacter


 * Original Fan Fiction Characters.

Template:Fan Fiction Characters will be added to all character pages. It will add the page it is used in to Category:Fan Fiction Characters.

Is it possible to make Template:Fan Fiction Characters to add the page it is used on to Category:Original Fan Fiction Characters if the page is not in Category:Samurai Pizza Cats Characters?

Teyandee 12:29, May 7, 2011 (UTC)
 * You haven't made it 100% clear, but what I think you're trying to do is:


 * Use a bot to add the Fan Fiction Character template to all members of the category: Fan Fiction Characters
 * Not add this template if the page is in the Category: Samurai Pizza Cats Characters
 * If this is what you want to do, then you can set up AutoWikiBrowser to do the following:


 * 1) In the More... dialogue, enable Append/Prepend text, choose prepend to put the template at the end, or append to put it at the start, and then type the template you want to add
 * 2) In the Skip dialogue, tick the "Contains" box, and type {{SPCCharacter
 * 3) Build a list on AWB. With the Source Box having the option "Category" and the Category being Category:Fan Fiction Characters. Run the bot
 * If this wasn't what you wanted to do, post here with any corrections, and I'll tell you how to do that  Random Time  12:43, May 7, 2011 (UTC)
 * It looks to me like you have two templates, one that categorizes pages as Samurai Pizza Cats and one that categorizes pages as Fan Fiction Characters, and you want to tag all character pages as Fan Fiction Characters if they haven't already been tagged as Samurai Pizza Cats. That's possible, but it'd be a lot easier if the pages you wanted to tag already had a category in common, like "characters" or something like that. {{User:Monchoman45/SigReal|13:07,5/7/2011}}


 * @Randomtime:
 * You have got the idea. But I want not just to do one-time categorization. I need a solution for an automated categorization: A page must be added to Category:Original Fan Fiction Characters after Template:Fan Fiction Characters is added to that page and that page is not in w:c:spcfanfics:Category:Samurai Pizza Cats Characters. (If that page belongs to Category:Samurai Pizza Cats Characters that it should not be added to Category:Original Fan Fiction Characters).


 * @Monchoman45:
 * They have a common category - Category: Fan Fiction Characters which is added by Template:Fan Fiction Characters
 * Teyandee 15:19, May 7, 2011 (UTC)
 * Unless I'm mistaken, there's no way for a template to check that a page it is on is in another category, that it doesn't add itself, so I don't think there's a solution - however Monchoman45 may well know some parser funtions trick that I don't  Random Time  15:28, May 7, 2011 (UTC)

Generally, in a fanfic setting, I like to avoid having autocatting templates that also do presentation.

The solution is to make this an explicit setting, i.e. use a parameter  that'll do {{#ifeq:  {{lc:{{{canon|no}}}}}| yes | | }} You only have 32 canon characters (the SPC wiki lists only 30?), so it wouldn't be much work to add the parameter for these pages. Would that suit your needs? --◄mendel► 22:17, May 7, 2011 (UTC)


 * I got the idea but I made it a little different:
 * spc parameter is added to Template:Fan Fiction Characters. It will categorize the page it is used on depending on whether is has spc=yes:

{{#ifeq:{{{spc}}}|yes
 * }}
 * }}


 * The articles about the SPC characters now have that parameter ( {{Fan Fiction Characters|spc=yes}} ) : http://spcfanfics.wikia.com/wiki/Abigail


 * The problem now is: Categories should not be added to the template page itslef.
 * <*noinclude> will remove the categories from the artricles.
 * <*includeonly> prevents the categorization of the template but will not add the categories to the articles.
 * <*onlyinclude> categorozies the pages but will add the template itself in the category.
 * I need help with that. Teyandee 09:05, May 8, 2011 (UTC)

{{NAMESPACE}} {{#if:{{NAMESPACE}}|| {{#ifeq:{{{spc}}}|yes }}
 * }}
 * }}
 * {{NAMESPACE}} is blank for mainspace, so the "else" branch of the condition triggers for that, and not for any other namespace. --◄mendel► 10:22, May 8, 2011 (UTC)


 * It works! Thank you. Teyandee 10:40, May 8, 2011 (UTC)