Forum:Making a template that automatically adds categories? Read this.

If you've ever made a template which automatically adds categories, you know there's a little problem that sometimes happens. You can easily end up putting the template itself into the category the template populates.

Imagine you had the template, Time Lord and it put pages into category:Time Lord. Chances are, you've probably got template:Time Lord in category:Time Lord, unless you've manually coded around the problem.

Now we've got a much easier way round the problem. In your template, just use cat. So, if you wanted your template to put pages into category:Time Lord, you'd just add to your code. That's it! Super easy.

Here's a live example of a template Skittles the hog recently made. (Note that the vertical spacing is for clarity of illustration. Please don't format your code this way on a "live" template>)

&#91;disputed statement&#93;

If you have any questions, please feel free to get in touch with me. 22:16:30 Mon 29 Aug 2011