Format Rules/Templates
Using templates can make things a whole lot easier if you have a lot of repetition in your story. Basically, a template is a page that can be inserted into any other page. This is especially handy for Game-type stories.
To make a template, all one has to do is name the template, and surround it with double curly braces {{Template:My Template}}
. Then, you click on the red link that it generates, and make your template page the way that you make a normal page. Templates should always be added to the story category as well as the template category: [[Category:My Story]] [[Category:Template]]
.
So that is handy in and of itself, but what really makes Templates truly useful is that they can accept Parameters. You can think of Parameters as bits of information that might change from one use of a template to the next. You can define a Parameter by placing the parameter name in triple curly braces where you want the information to show up on your Template page: {{{My Parameter}}}
.
Let's make a basic status bar for a Game-type story as an example. In this example I will also be using some table markup and CSS, but that is not necessary for a template. They follow the same rules as a normal page.
To save you the trouble of going to the template page, and looking at the source, the page contains the following:
{| width="100%" | bgcolor="#LLCLL" valign="top" width="16%" colspan="2"| '''Status''' | bgcolor="#LLCLL" valign="top" width="84%"| '''Equipment:''' |- | bgcolor="#OOFOO" valign="top" width="8%"| Health | bgcolor="#DDFDD" valign="top" width="8%"| {{{Health}}} | bgcolor="#GGFGG" valign="top" width="84%" rowspan="3"|''{{{Equipment}}}'' |- | bgcolor="#OOFOO" valign="top"| MP | bgcolor="#DDFDD" valign="top"| {{{MP}}} |- | bgcolor="#OOFOO" valign="top"| Level | bgcolor="#DDFDD" valign="top"| {{{Level}}} |} [[Category:Format Rules|Status Sample]] [[Category:Template| ]]
Now, you may have noticed that the parameters are all empty. Well this will not do. Lets fill them. You fill a parameter by adding a vertical bar and the ParameterName=Value. Do this for each parameter thus: {{Template:Status Sample|Health=100|MP=50|Level=1|Equipment=Wooden Sword, Peasant Clothes}}
. Notice that it is a bit cumbersome and difficult to read; and that's with just four parameters. Well, you can break it up into multiple lines, thus:
{{Template:Status Sample |Health=100 |MP=50 |Level=1 |Equipment=Wooden Sword, Peasant Clothes }}
Isn't that easier to read? Now lets see what it looks like:
If you want to get into Templates more in depth, you can read more at https://meta.wikimedia.org/wiki/Help:Template.