Board Thread:Support Requests - Getting Technical/@comment-5985694-20130117195352/@comment-3444778-20130117224923

Well, that snippet of code right there seems out of context. But if you want to learn how to master these codes, you'd have to familiarize yourself with ParserFunctions and Tables. The best thing to do is make a sandbox page and experiment with the stuff that you learned on MediaWiki.

As far as the rest of it goes, I'll try to explain the template conditions as best I can. If you go to  and write the code: Hello, world! Publish it, then you can go to another page, type Publish. On the finished page, you'll have a  element (inline text) in blue, reading, "Hello, world!"

Now for the explanation of what happened. Hopefully you know how HTML tags work, as they are completely essential for knowing how to make templates, and I don't have to explain the  tags. I set  as an attribute for the tag, and I filled its value with CSS. CSS is a code used for styling HTML elements, or changing how they look. It just wraps around the HTML framework, and typically doesn't create any new elements of the page. is a CSS property, which just changes the text color, but the main part is with the value. Normally you would just put the name of a color, or a hex code, or an rgb code, and your browser would interpret that string and change the text color accordingly. What I did instead was set up a WikiText variable, which can be any word surrounded by three curly braces (it's  with the pipe in this case, because we don't want a default value to be defined; if you wanted it to be white if the variable isn't called on the target page, you'd put  ). On the second page, you called the template by using two curly braces and the name of the template, which would be. This just imports the contents of  to the page. was included inside the code to set the  variable that was defined on the template page. Wikia read the value  on your target page, and substituted it in for the condition. You can use this trick to allow users to define custom variables in a template skeleton. Therefore, everyone can use the text "Hello, world!" without having to type it out, but still be able to easily change the color.

And hopefully that made sense, I don't think I can make it simpler than that. If you're still confused, all I can say is... experiment with it. Trial-and-error is the best way to learn; not only do you learn how to do things the right way, over time, you learn all of the ways that it shouldn't be done, which will save you a lot of frustration later. So, familiarize yourself with tables and parser through the MediaWiki documentation along with sandbox experimentation, and you should be easily capable of designing a well-functioning template!