Help:Adding Pages to Categories and Templates: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(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...")
 
(Removed useless template reference)
 
(40 intermediate revisions by 14 users not shown)
Line 1: Line 1:
==Introduction==
==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?
Did you create a new page, such as a function, and it isn't showing up in a list? Did you try and edit it in only to see <nowiki>{{weird_tags_like_this}}</nowiki> instead of text relating to the page you viewed? Welcome to the world of templates. We have noticed in [[Special:RecentChanges|RecentChanges]] that people are making pages and not linking to them properly. '''These pages are being lost in the bowels of the Wiki!'''


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!
We also use categories in this wiki, but they are not as crucial as templates. Please read on to learn about both and to understand how to contribute to our wiki properly.
 
Read on to understand how to add content correctly...


=Template=
=Template=
===What is a 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.
It is like a big copy paste on a clipboard. You write a template tag on another page and it writes everything that was on the template page.


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.
*'''Why Use Templates?'''
It allows the same information to be represented in multiple places, without duplicating texts and updating them manually numerous times.


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.
*'''Example?'''
Look at the page source (edit button) on our functions or event pages. You can see that the functions aren't actually listed there, each function group has its own template. The main use for this is to fill out the "See Also" section of individual functions with their related functions.


===How do you use a template?===
===How Do You Make/Edit/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!
The best way to teach is by example. I will need a template to direct people to this guide from multiple pages in the wiki. Let's just create this template together! FUN!


====1. Choosing a Template Name====
====1. Choosing a Template Name====
Think of a good name for your template. Your template will take the form of "{{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.
The best template name explains what it is. Typically the best thing is to make the template URL identical to the actual page. Therefore I am going to use:
 
<pre>http://wiki.multitheftauto.com/index.php?title=Template:Adding_Pages_to_Categories_and_Templates</pre>
 
'''IMPORTANT:''' Remember that all wiki pages are case sensitive. The same page can exist in uppercase and lowercase! Capitalize appropriately.
 
If I tried to link to a template that doesn't exist this happens:
<span style='color:#ff8585 !important'><nowiki>Template: link to nonexistant template click here to create</nowiki></span>
 
So as you can see, it is better we create the template before attempting to link to it!


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


<syntaxhighlight lang="xml">{{Adding_pages_to_categories_and_templates}}</syntaxhighlight>
At the template page, hit create page, and you'll see the edit field box. Type in whatever you need to be said in other pages and save the page. It could be simple text, links to a set of functions, or even as advanced as a bit of code that determines something, such as our future functions template. If you were trying to add to our functions/events then you would just edit a link to your function into the template. Don't screw it up or I will be disappointed in you!


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:
From this point, you use the template page name as a tag inside the pages where you want to use it. My template tag is:


{{broken_template_that_doesnt_exist_yet_but_heres_a_link_to_make_it_lazy_pants}}
<pre>{{Adding_Pages_to_Categories_and_Templates}}</pre>


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...
====3. Demonstration====
So here I will actually link to the template. If you check the template page source, you will see exactly what is printed below:


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


http://wiki.multitheftauto.com/index.php?title=Template:Adding_pages_to_categories_and_templates
'''Note:''' The easiest way to reach a template that was used on a page is to edit the page and scroll to the bottom. A list of all templates used will appear with links to the template pages. For something like the main function pages you have to edit the ENTIRE page to see templates used at the bottom, they do not appear if you only edit a section.


====2. Filling out the Template ====
=Category=
===What is a Category===
Categories group pages together. The categories have their own special page where all the grouped pages are alphabetized. Think of them like sorting the Wiki into folders for common pages. For example here is a link to the server functions category page: [[:Category:Server_functions]]


The first thing you do when you get to the new page is hit create page. This takes you to the 'edit' field box.
===How do I Make/Edit/Use Categories===
A page is put into a category by editing the following syntax into a page:
<pre>[[:Category:pagename]]</pre>


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.
You do need to create the category page just as you would a template. Again, you simply go to the URL of the category page you want to make. The format is:
<pre>http://wiki.multitheftauto.com/index.php?title=Category:Page_Name_Here</pre>


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 <nowiki>{{Adding_pages_to_categories_and_templates}}</nowiki>
For the category page itself, you simply write a small explanation what the category (folder) is about.


====3. Demonstration====
If you look at the source of the pages listed in [[:Category:Server_functions]], you may notice that the category tag is not in them! It actually is there, but it is being applied through the clever combination of a template with the category embedded.
So here I will actually link to the template. If you check the template page you will see exactly what is printed below:
 
Those nice colored stripes you see at the tops of pages are all templates that have a category tag embedded. This was designed to make it hard for people to mess-up categories. For example, look at the page source for the blue stripe that says "Client and Server Function" http://wiki.multitheftauto.com/index.php?title=Template:Server_client_function&action=edit
 
===Demonstration===
I have put a category tag in this page. This is reflected at the very bottom of the page you are reading right now. The category page just happens to be the exact same name. Unlike templates, it is not typical to name the category after a page. They are more like folder names. This is just for demonstration however.
 
The category page is here: [[:Category:Adding_Pages_to_Categories_and_Templates]]
 
[[Category:Adding_Pages_to_Categories_and_Templates]]
 
=More Info=
===Lists of Templates and Categories===
Looking for template and category listings? This is one thing [[Special:SpecialPages|SpecialPages]] is for.
 
'''Templates:'''
*[[Special:UncategorizedTemplates]]
:Templates not organized into templates (ie think of categories as folders).
*[[Special:UnusedTemplates]]
:Unused templates
*[[Special:WantedTemplates]]
:Tags are linked to this template, but the page itself doesn't exist. It still works de facto. You need to hit create on the template page.
*[[Special:MostLinkedTemplates]]
:Templates that were tagged in the most pages
 
'''Categories:'''
*[[Special:Categories]]
:All categories overview.
*[[Special:UncategorizedCategories]]
:Categories not within another category (ie not used as subfolders of folders).
*[[Special:UnusedCategories]]
:Unused categories
*[[Special:WantedCategories]]
:Tags are linked to this category, but the page itself doesn't exist. It still works de facto. You need to hit create on the category page.
*[[Special:MostLinkedCategories]]
:Categories that were tagegd in the most places
 
===Further Reference===
http://en.wikipedia.org/wiki/Help:Template<br>
http://en.wikipedia.org/wiki/Help:Category
 
===See Also===
[[MTA_Wiki:Editing_Guidelines]] - This is a complete overview of how we use Wiki for MTA, this was only part of it. Please read this!
 
===Questions?===
Best way to discuss wiki is live on IRC. See the community box on the [[Main Page]] for more info.


{{Adding_pages_to_categories_and_templates}}
[[Category:MTA Wiki:Editing]]
[[Category:Tutorial]]


=Category=
[[en:Adding Pages to Categories and Templates]]
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.
[[ru:Adding Pages to Categories and Templates]]
[[hu:Adding Pages to Categories and Templates]]

Latest revision as of 07:46, 28 September 2023

Introduction

Did you create a new page, such as a function, and it isn't showing up in a list? Did you try and edit it in only to see {{weird_tags_like_this}} instead of text relating to the page you viewed? Welcome to the world of templates. We have noticed in RecentChanges that people are making pages and not linking to them properly. These pages are being lost in the bowels of the Wiki!

We also use categories in this wiki, but they are not as crucial as templates. Please read on to learn about both and to understand how to contribute to our wiki properly.

Template

What is a Template

It is like a big copy paste on a clipboard. You write a template tag on another page and it writes everything that was on the template page.

  • Why Use Templates?

It allows the same information to be represented in multiple places, without duplicating texts and updating them manually numerous times.

  • Example?

Look at the page source (edit button) on our functions or event pages. You can see that the functions aren't actually listed there, each function group has its own template. The main use for this is to fill out the "See Also" section of individual functions with their related functions.

How Do You Make/Edit/Use a Template?

The best way to teach is by example. I will need a template to direct people to this guide from multiple pages in the wiki. Let's just create this template together! FUN!

1. Choosing a Template Name

The best template name explains what it is. Typically the best thing is to make the template URL identical to the actual page. Therefore I am going to use:

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

IMPORTANT: Remember that all wiki pages are case sensitive. The same page can exist in uppercase and lowercase! Capitalize appropriately.

If I tried to link to a template that doesn't exist this happens: Template: link to nonexistant template click here to create

So as you can see, it is better we create the template before attempting to link to it!

2. Filling out the Template

At the template page, hit create page, and you'll see the edit field box. Type in whatever you need to be said in other pages and save the page. It could be simple text, links to a set of functions, or even as advanced as a bit of code that determines something, such as our future functions template. If you were trying to add to our functions/events then you would just edit a link to your function into the template. Don't screw it up or I will be disappointed in you!

From this point, you use the template page name as a tag inside the pages where you want to use it. My template tag is:

{{Adding_Pages_to_Categories_and_Templates}}

3. Demonstration

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

Contributors: Did you create a page but it's not on this list? Confused? Read: Adding Pages to Categories and Templates

Note: The easiest way to reach a template that was used on a page is to edit the page and scroll to the bottom. A list of all templates used will appear with links to the template pages. For something like the main function pages you have to edit the ENTIRE page to see templates used at the bottom, they do not appear if you only edit a section.

Category

What is a Category

Categories group pages together. The categories have their own special page where all the grouped pages are alphabetized. Think of them like sorting the Wiki into folders for common pages. For example here is a link to the server functions category page: Category:Server_functions

How do I Make/Edit/Use Categories

A page is put into a category by editing the following syntax into a page:

[[:Category:pagename]]

You do need to create the category page just as you would a template. Again, you simply go to the URL of the category page you want to make. The format is:

http://wiki.multitheftauto.com/index.php?title=Category:Page_Name_Here

For the category page itself, you simply write a small explanation what the category (folder) is about.

If you look at the source of the pages listed in Category:Server_functions, you may notice that the category tag is not in them! It actually is there, but it is being applied through the clever combination of a template with the category embedded.

Those nice colored stripes you see at the tops of pages are all templates that have a category tag embedded. This was designed to make it hard for people to mess-up categories. For example, look at the page source for the blue stripe that says "Client and Server Function" http://wiki.multitheftauto.com/index.php?title=Template:Server_client_function&action=edit

Demonstration

I have put a category tag in this page. This is reflected at the very bottom of the page you are reading right now. The category page just happens to be the exact same name. Unlike templates, it is not typical to name the category after a page. They are more like folder names. This is just for demonstration however.

The category page is here: Category:Adding_Pages_to_Categories_and_Templates

More Info

Lists of Templates and Categories

Looking for template and category listings? This is one thing SpecialPages is for.

Templates:

Templates not organized into templates (ie think of categories as folders).
Unused templates
Tags are linked to this template, but the page itself doesn't exist. It still works de facto. You need to hit create on the template page.
Templates that were tagged in the most pages

Categories:

All categories overview.
Categories not within another category (ie not used as subfolders of folders).
Unused categories
Tags are linked to this category, but the page itself doesn't exist. It still works de facto. You need to hit create on the category page.
Categories that were tagegd in the most places

Further Reference

http://en.wikipedia.org/wiki/Help:Template
http://en.wikipedia.org/wiki/Help:Category

See Also

MTA_Wiki:Editing_Guidelines - This is a complete overview of how we use Wiki for MTA, this was only part of it. Please read this!

Questions?

Best way to discuss wiki is live on IRC. See the community box on the Main Page for more info.