Forum:Switch template not showing links for offline users

Hi all, I seem to have a strange "bug" with a switch template on the Dragonvale Wiki http://dragonvale.wikia.com/wiki/Template:Switch4 It should change the image automatically like it does here: http://dragonvale.wikia.com/wiki/Plant_Dragon

It works fine when logged in, but if you log out it won't show links.

I did send in a bug report but the wikia staff member told me to make a forum here instead. I hope someone can help me with this because I am clueless how to solve this. Essiw 13:04, August 24, 2012 (UTC)


 * Yeah this is custom coding so Wikia won't touch it. You're stuck with us here at community, I'm afraid. :)


 * This template of yours is doing rather precisely nothing for me. If there's supposed to be some kinda image changing, it doesn't show up for me at w:c:dragonvale:Plant Dragon. And I'm logged in.  So I don't think you have anything working at all.


 * My quick glance at your your Wikia.css and your Common.css shows a couple of problems.


 * Your Wikia.css doesn't seem to import your Common.css at all.  This means anything you have in your Common.css file isn't actually going anywhere or doing anything.  You need to import the Common.css into the Wikia.css (and Monobook.css, come to that), for the Common.css declarations to have any effect.
 * You're calling a ton of classes in w:c:dragonvale:template:switch4. None of these are defined in your CSS, so most of your template won't work at all.  I've checked to see whether you have a Wikia.js file and you don't.  So if there are no .js or .css definitions, you can't really expect a call like the following to work:    Somewhere, either in .css or .js, you'd have to define the attributes for   — and you haven't.  At least, not that could I find.  (Secondarily, I'm really not sure that a class call like this would work, anyway.  It seems like you're trying to call a ton of different classes — not a single one with a seriously long name. I don't know where you picked up this code, but it seems most . . . unconventional.)


 * If I had to take a bet on the problem, I'd say that you've put all the .css/.js in your personal .css and .js files, which explains why you see it when you're logged in, but not when you're logged out. That would also explain why you see it when logged in, but I don't.   23:02: Sat 25 Aug 2012


 * Thank you for your answer, but I was not the one that made that template (I only fixed it), I don't have any personal .js pages at all, and they seem to work for everyone on my wiki. Are you on mono book? Maybe it doesn't work on there.
 * I am also not sure how to import the css, but I will try to find it Essiw 13:46, August 26, 2012 (UTC)


 * I see the problem. Basically, the script can't handle SVG elements which will cause it to crash. Find this section in w:c:dragonvale:MediaWiki:Common.js:


 * Change the indicated line to this:


 * Lunarity 15:05, August 26, 2012 (UTC)
 * Ahhh, you're right Lunarity. I didn't even think to check Common.js.  Because the site had no styling in Monobook, I figured they'd been Wikia-centric in their design approach.  That's whatI get for thinkin'.  Ahh, well.


 * Than you for your answer, I changed it to what you said, but it still doesn't seem to work :( Essiw 15:26, August 26, 2012 (UTC)


 * You need to refresh your cache, it works for me. Lunarity 16:10, August 26, 2012 (UTC)


 * Strange, I thought I did that already, it works indeed, thank you very much :D Essiw


 * Though unrelated to the question being asked, you still need to import your Common.css into Wikia.css and Monobook.css, Essiw.  The help file for that is at Help:Including additional JavaScript and CSS.   15:19: Sun 26 Aug 2012
 * So If I get it right, I need to put:

importArticle({               type: "style",                article: "MediaWiki:Common.css"            });
 * In both the Wikia.css and Monobook.css ? Essiw 15:26, August 26, 2012 (UTC)

(Reset indent) That's it! I should advise that there are other ways to do it, but you don't have enough customisation to dissuade you from using the new Wikia-recommended method. 16:38: Sun 26 Aug 2012
 * Oh, wait. You put this code in Wikia.js and Monobook.js — not the .css files.  16:40: Sun 26 Aug 2012


 * You'd be better off adding:


 * to Wikia.css. You do not need to import Common.css into Monobook.css, that happens automatically. Lunarity 16:47, August 26, 2012 (UTC)