Forum:Template and categorization help

I've got a some-what complicated question. At the Wheel of Time wiki, we have a character template. This template categorizes individual pages based on different fields.

We are trying to implement a new function that categorizes characters based on their last appearence and their last mention. What we would like to do is have this new fucntion "read" another field and detirmine if the categorization needs to be applied to the page.

For example, right now pages are categorized in the "Living", "Deceased" and "Status Unknown" categories based on the template field "status" with parameters of "Alive", "Dead" and "Status Unknown". The new function we are trying to impliment is a "Last appeared" and "Last mentioned" fields. What we would like to happen is for the two new fields to read the "status" field and categorize it only if the status field is set to "Alive" and to suppress categorization if not. For example, a character died as of book 5 but has been mentioned since then and should not be categorized in the "Alive (as of xxx)" category.

Related to this, we would also like to have the "Last mentioned" field take precedent over the "Last appeared" field. For example, a character who was last seen in book 11 but last mentioned in book 12 would need to be categorized in the "Alive (as of book 12)" category.

Any help would be appriciated. Thanks!!! Willie -  HtS  14:49, July 19, 2010 (UTC)
 * Right, that's complicated - probably moreso for me who doesn't have an understanding of your templates, as I don't edit your wiki, you probably know exactly what you want to do. Luckily, MediaWiki has Parser Funtions to help with complex template situations. Remember that templates with a lot of parser funtions are expensive (in processing time) to run by the server, especially if there are a lot of edits to the template. I suggest you sandbox a version of the template and try out the things you're trying to do, before you implement it into the real template.
 * From what I understand, you want to categorize one funtion, if it appeared in another. Thus, the character would appear in the Category: Unless  is set, in which case,.
 * If this is, indeed the case - then the code you'd need is:


 * (BTW, I havn't tested this code, and can't guarantee it's accuracy, it's just an example of how you'd use parser funtions, I'd recommend you read the help page on ParserFuntions, and the help on how to use it in templates and try some out in a sandbox before you commit any changes to the template, or wait until someone who's better at using parser functions than me comes along and changes my code. -- Random Time  15:27, July 19, 2010 (UTC)