Template talk:Mech Model

There should be a "stock engine" thing in the template... ==MeepSire 23:21, 15 November 2012 (CST)
 * same wish; Engine:: and Engine::, whereas first one is rating, and type can be 'fusion std' or 'fusion xl'. Think the prob was, having too many 'standard'-items, not stating what it exactly is.==Fleur, 21.1.13 19:10 CET
 * We would need to change all 'Mech pages ahead of time to use the correct entry for both lines. Other than that, it would just be a matter of making sure future 'Mech pages used to correct entries as well.--Seth 14:34, 21 January 2013 (CST)

The template needs to be changed so that the engine rating is no longer displayed as a link. ==MeepSire 01:27, 28 December 2012 (CST)
 * What I need to do is have every section on there link to a numbers table for that attribute on each 'Mech for the delight of number crunchers everywhere. For example, that rating link will need to point to a table of engine ratings for all 'Mechs.--Seth 06:57, 28 December 2012 (CST)

Properties
A number of properties are used on this page. To tell the difference between a property and a link, look for the :: inside of the square brackets. Take the tonnage property for example. In the template, it appears as Tonnage::. This means that on the page where the template is used and the "|tonnage= " line is added, that page will then include a tonnage property.

Properties are used in this wiki primarily to build auto-generating tables. The tables on the Template:Hardpoints Table page is generated automatically using information entered on the BattleMech pages.

Properties themselves come in several different types, but the ones you will see primarily on this wiki are Number and Text properties with a smattering of page and date properties. If you use the tonnage property again, when you visit the Property:Tonnage page, when you go to the edit screen you will see has type::number in the text. That is how the tonnage property is defined as being a number property. This allows the auto-generating table to organize and sort the 'Mech pages by tonnage. It also makes it possible for some parser functions (look for math symbols in the attributes section) to use these defined number properties to do math. Specifically, the bonuses for completing basic and elite pilot tree efficiencies are automatically calculated do we don't have to when creating the pages.

The downside to number and text properties is that they cannot be linked. The only type of property that can be linked inside a page is a page property (has type::page). Those however aren't as useful to us since they create a link to what ever line is entered on the template page, even if that page doesn't exist. Instead, a better alternative is to link the title of the line to the relevant page. The tonnage line for example can have the Tonnage: line turned into Tonnage: so the user can see a full table of all 'Mechs organized by weight. --Seth 23:24, 8 January 2013 (CST)

How does this template work
This template is probably the single most complicated page on this wiki. It makes use of the template itself in the individual 'Mech pages. Within the template, it has properties, css tricks, parser functions, math functions, transclusion, and not to mention the wiki format of tables. I will try explain how this whole mess works.

Templates
A template page is a special type of page that can be embedded into other pages. Changes made to the template will be reflected on any number of pages that the template is included in. This makes it very easy to update a large number of pages that display the same information quickly.

Go on...
To create a template page, type a page name into the search bar with the added namespace of "Template:". For example, "Template:Paper Towels". Assuming there isn't already a Template:Paper Towels page (and there isn't as of this writing), you will be shown a page that tells you no such page exists and gives you an option of creating one by clicking the red link.

What then?
From there you are taken to a new page with a large blank text area. Anything you add and save on this page will make up the Template. For example, if I add "Paper towels are useful for cleaning up spills" and save that to the page body, any page where I display the Paper Towel template will show the content of the template, "Paper towels are useful for cleaning up spills".

How do you add a template to a page
Enter the name between two squiggly lines. If you want to display the Paper Towels template in your page, you would use.

Why would you want to say the same thing in a bazillion different pages?
It's useful to display static information in a number of pages in many cases. For example, the Template:MechWarrior Online Wiki footer table is a great way to get around the wiki quickly. But there are other cases when you want to have a standard format in many pages, but with different content. This is what the Template:Mech Model is an example of. All pages that display information on specific 'Mech Models all share the same basic format, but have their own specific information on them.

So how do you do that?
Template can use place holders that allow you to add different information in various pages. So, if on the Template:Paper Towels page, I have a field called then I can enter what ever I want to in the place of  on pages that I use templates. For example, if the Template:Paper Towels page said, "Paper towels are useful for cleaning up " then on my page where I want to use the template, instead of using just I would use. On my new page, the text would read as "Paper towels are useful for cleaning up messes.

Lets dive into that place holder thing real quick
On my template page, I used as a place holder. That allows me to enter what I want into that field by using the line "|things = ". But if I don't enter anything into that line, my template shows which just looks weird. I have a couple of options. If I used as my place holder, then on the page where I use the template it will either display what I enter on the "|thing = " line or nothing at all. That fixes the problem of showing on my page, but what if I want a default option in case I forget to add something to the |thing = line? Then I would use. So the place holder "thing" is still there for me to change with the |thing = line, but if I enter nothing then the default value of "spills" will be displayed. There are other ways of customizing place holders, but that covers the basics. For more reading, check out the Help:Templates page.

Ok, I've mastered place holders. What next?
Another thing that is used quite often in the Mech Model template is statements. These allow me to show certain information or sections if a specific field is entered. This allows me to hide a section if no data for it is entered. For example; If information is entered on the line "|year introduced = 1950", then the sentence "This brand was introduced in 1950" would appear. A more complicated example can be found in this Mech Model template. This adds the information entered on the line "|image = " into an Image tag that both centers and gives it a fixed size. If no image is added to the line, then the Image tag doesn't show up missing information.

TOBECONTINUED