Help:Embeddable templates
From CruisersWiki
Line 1: | Line 1: | ||
{{red|This is a draft. Don't use it in production!}} | {{red|This is a draft. Don't use it in production!}} | ||
+ | ===A short introduction into MediaWiki templates=== | ||
There are 2 kind of templates in this wiki and one should not be mistaken for another: | There are 2 kind of templates in this wiki and one should not be mistaken for another: | ||
* An article template (or [http://www.cruiserswiki.org/wiki/Pagetemplates Page template]) is essentially an article's stub or a boilerplate. To create a new article a user simply copies it's wiki text and pastes it into a new empty article page. | * An article template (or [http://www.cruiserswiki.org/wiki/Pagetemplates Page template]) is essentially an article's stub or a boilerplate. To create a new article a user simply copies it's wiki text and pastes it into a new empty article page. |
Revision as of 17:28, 19 February 2015
This is a draft. Don't use it in production!
A short introduction into MediaWiki templates
There are 2 kind of templates in this wiki and one should not be mistaken for another:
- An article template (or Page template) is essentially an article's stub or a boilerplate. To create a new article a user simply copies it's wiki text and pastes it into a new empty article page.
- A MediaWiki template on the other hand generally used to bring a smaller sniplet of mediawiki markup into an article page. They could be seen as a sort of shortcuts introduced into a wiki to implement some common pattern to avoid excessive typing and errors and to implement some common style.
In this sense a MediaWiki template can be seen as a stencil for some article's feature while an article template is more like a foundation for a whole article.
Similar to an article template a source text for MediaWiki template is stored in a wiki page prefixed with "Template:". The difference with a normal wiki page (or an article template) and MediaWiki template is that the later kind of a template is designed to be embedded (or https://www.mediawiki.org/wiki/Transclusion transcluded]) into another page.
Using templates
In the text below MediaWiki templates will be called simply templates.
Suppose you have a Template:Hello
Hello world!
Then this text can be embedded into another page with this construct:
{{hello}}
An expanded text of a template could be modified with template parameters. Imagine some other template could be called:
{{morning|Earth}}
And give:
Good morning Earth!
Or even like this:
{{go | destination=the Universe}}
Could give:
Our destination is the Universe