How To Use MediaWiki Templates

From Agony Unleashed
Revision as of 18:05, 10 May 2009 by Aether (Talk | contribs) (Usage)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Click here to go back: Agony:Main Page

Basic Info

What is a template you say? A MediaWiki template is a special page in MediaWiki, that you create, that can help with the initial creation of page in a wiki site.

For example, Agony Empire offers many certifications for people to take. Each one of these certifications requires a wiki page where a potential receiver of the certification can find out about the certification such as fees, required certifications and an idea about what the certification will entail. To help make the process easier for making a certification page, there is a template page setup here.

A template page must be made in the Template namespace, such as Template:MyTemplate. You can create this page by typing into your web browser http:///www.agony-unleashed.com/wiki/index.php?title=Template:MyTemplate and hitting the Go button, you will be taken to a page called "Template:MyTemplate". A simple template page acts like a normal wiki page where you edit the page and put what text you want on that page.

On the certification template page, there is only basic boilerplate text for a certification. This text is meant to be replaced once it is inserted into a new certification page with specific information about that particular certification.

Usage

Now that we have a template we can use, we want to insert that boilerplate text into a new certification page we are creating. Create the new certification page and go to edit that page. To insert that template text, all you must do is type:
{{subst:Certification}}

To create a new ship setup type in the following and save the page:

{{subst:ShipSetup}}

This causes the text from the template page to be copied into the new page permanently where from there. You can then edit the page to conform it to your needs.

Once you type that subst code into the page, go ahead and save the page to make that copy happen and go right back to editing it. The template text is now there and ready for you to edit.

Summary

  1. Copy/paste "www.agony-unleashed.com/wiki/index.php?title=Template:NameOfYourTemplate" into your browser and hit enter.
  2. This will open a new blank page that will say "Template:NameOfYourTemplate" at the top. Hit "Edit" at the top of the page.
  3. Create your template.
  4. To use your template start a new Wiki page and click on it to start editing.
  5. Type in {{subst: name of your template here}}
  6. Hit "Save Page"
  7. You will see your template being copied over to the page. Hit edit to start editing it.