Help:Adding Pages to Categories and Templates

From Multi Theft Auto: Wiki
Revision as of 15:40, 6 August 2012 by Ransom (talk | contribs) (Created page with "==Introduction== Have you wondered why your new page has not shown up on the function/event page or other lists? Do you try to edit in a link to your page, only to notice weird t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Have you wondered why your new page has not shown up on the function/event page or other lists? Do you try to edit in a link to your page, only to notice weird tags and none of the page code is showing?

We have noticed new pages being created that are not showing up on lists like they should. These pages are being lost in the bowels of the Wiki! Creating a new page in and of itself is not enough to contribute, but do not despair, because it is not much harder than that!

Read on to understand how to add content correctly...

Template

What is a Template

Think of a template, in essence, as a big copy paste on a clipboard. If you make a template page and link to it, whatever you put on that page is going to show up on the page you linked to.

The purpose of a template is to have 1 copy of text that can be used in multiple places. This template can be changed and the change will be reflected globally. If you did not use this, you would have to keep copying and pasting the same texts and code and update each instance constantly. Before you know it, you have outdated copies and incorrect copies and so on.

One place where we use templates is the function and event pages. Each grouping of functions (ie "Audio Functions") has its own template. One good reason for this is so we can fill out the "See Also" section within each page simply by linking to the template.

How do you use a template?

The best way to teach you how to make new templates and add to templates is by going through the process of making one. I happen to need a template to direct people to this page from various pages of the wiki. So lets just go through the steps! FUN!

1. Choosing a Template Name

Think of a good name for your template. Your template will take the form of "Template:My Template" inside of other page sources where it is used. Therefore, the best template name is one that explains what the template is, without someone having to actually look at the template to figure it out.

Typically the best thing to do is make a template with the exact same name as the page. So I will use:

{{Adding_pages_to_categories_and_templates}}

If you did not make the template page yet but you linked to it, instead of it showing what is on the template page you get something like this:

Template:Broken template that doesnt exist yet but heres a link to make it lazy pants

So as you can see, it is better we create the template before attempting to link to it! "How do I create a template without linking to it first?!" I hear you shouting at the screen...

You simply type a URL of the page you would like the make. Using the name I decided upon above, my link is:

http://wiki.multitheftauto.com/index.php?title=Template:Adding_pages_to_categories_and_templates

2. Filling out the Template

The first thing you do when you get to the new page is hit create page. This takes you to the 'edit' field box.

From here you type in whatever you want to be pasted in other pages. It could be simple text, links to a set of functions, or even as advanced as a bit of code that determines something. An advanced example would be the black boxes we use specify forthcoming functions. They are auto-managed through a template with a nifty piece of code that asks what the current version of MTA is.

From this point, you simply edit your template tag into the page. Again, it is the template name surrounded by two braces. So mine is {{Adding_pages_to_categories_and_templates}}

3. Demonstration

So here I will actually link to the template. If you check the template page you will see exactly what is printed below:

Template:Adding pages to categories and templates

Category

Categories simply group pages together as they share a common bond. For example, all the client functions have a category. A page could be in multiple categories if you wish. Generally people have gotten this right even if they did not intend to, because the person copied a template from another page and edited it and left the category tag in.