User:Hatebunny/how to write templates

cid and cis use DPL, and updates to MediaWiki or DPL itself could actually break those...

Hard to say exactly what's happening without seeing the results firsthand.

The basic structure of templates is this:

closes the function.

For example:

In the case of this template, you're asking the if statement to determine if 1=1 is true. If it is true, you're telling it to write: "One equals one!" in the place of the statement. If it's not true, write the "One doesn't equal one!" statement.

This is the basic layout and structure of every single piece of every single template. Our more complicated templates have named fields that can be referred to later, so:

can be used in an if statement on the Template:Simple Template page like so:

This states that if 1 equals 1, write whatever we put into Field1, otherwise, write whatever we put into Field2. Here's another usage:

This (as a poor example) basically says, If you wrote "Whee!" in Field1, replace this whole if statement with "You wrote Field1!", otherwise, write "I don't know what you wrote."

It's a poor example because I don't believe you can use the equals sign on strings, but only on numerical values. I believe the #equals function is what you use on strings (it's been awhile). So the real way to write usage #2 is:

There's also an #ifeq function to make it less head-hurty: