Board Thread:Support Requests - Getting Technical/@comment-4189499-20140111054557

I was wondering if there was any way to have a template's CSS or class change depending on what page it's on, based on either the page's categories or DAB term, and also if it was possible for that template change to affect things outside the template itself.

Let me try and be a bit clearer here. There is a template (specifically an infobox) which I am designing for a certain wiki's pages, but there are two "types" of pages which it can be put on. The secondary type of page are distinguished by both a DAB term and a category. Let's say that I want to switch the background colour of the template from white to black only on those certain pages. Is there any way I could do that without either a) creating a gigantic #switch function listing all the pages (which would then have to be manually updated) or b) relying on users to set a parameter to true on all pages of that kind the template is on? If there is any CSS or JS that needs to be put in external style sheets or other MediaWiki pages, I can easily ask an admin of that wiki to do so.

Additionally, along with changing the template itself, is there any way that one could use the template as a basis for changing other elements on the page, such as when the template background is set to black, the TOC floats right instead of left? 