Help:Templates: Difference between revisions

No edit summary
(A bit of rewording)
Line 1: Line 1:
{{help}}
{{help}}


'''Templates''' are used on Grand Theft Wiki as easy ways to instantly insert a particular set of instructions. Common usages are the messages at the top of the page (including this page), or [[Help:Userboxes|Userboxes]].


Templates are used by putting their tag at the top of the page, or wherever they are needed. A template's tag is its name in curly braces.
'''Templates''' are used on Grand Theft Wiki to insert the contents of a template into a page.


Templates are made simply by creating a page called [[Template:Name]] - and whatever is on that page will show up in every instance of the <nowiki>{{Name}}</nowiki> tag on Grand Theft Wiki.
This can be used for messages like {{template|help}}, navigation boxes like {{template|gta}}, [[Help:Userboxes|Userboxes]], or more complicated templates that take input, such as {{template|template}}.


<nowiki>{{help}}</nowiki> shows up the banner at the top of this page. It is defined at [[Template:help]], and automatically assigns any page it is used on to a [[Help:categories|category]], which is [[:Category:Help]]. Not all templates do this.
<nowiki>Templates are all stored at [[Template:Templatename]]. They can then be included into a page using the code {{templatename}}.</nowiki>


Whenever the template is edited, each page that uses that template will change too. If you do not wish to link back to the template page, you can use <nowiki>{{subst templatename}}</nowiki>. Subst simply includes the contents of templatename once.
<nowiki>Whatever is on the [[Template:Templatename]] page will then show up in every instance of the {{Name}} tag on Grand Theft Wiki. If you change the template, every page using it will change too.</nowiki>


Any page can be used as a template, by putting a colon (:) at the start of the tag. <nowiki>{{:User:Xenon}}</nowiki> would show the contents of the [[User:Xenon]] page. Also, subpages can be linked to directly with a slash (/) at the start of the tag. [[Grand Theft Auto IV]] quickly includes [[Grand Theft Auto IV/infobox]] with the tag <nowiki>{{/infobox}}</nowiki>.
<nowiki>Templates that require input are used like this: {{templatename | Option 1 | Option 2}}. In the code of the template, those options are referenced as {{{1}}} and {{{2}}} etc. There are also options with specific names, such as {{templatename | title=Hello}}, which is referenced in the template code as {{{title}}}.</nowiki>




:'''[http://www.grandtheftwiki.com/index.php?title=Special%3AAllpages&from=&namespace=10 View all templates]'''
 
For example, {{template|help}} shows up the banner at the top of this page. It is defined at [[Template:help]]. That template shows the banner and also assigns any page it is used on to a [[Help:categories|category]], which is [[:Category:Help]]. Not all templates do this.
 
 
Whenever the template is edited, each page that uses that template will change too. If you just want the template contents ''copied'' into the page rather than actively linked, you can use <nowiki>{{subst templatename}}</nowiki>. Subst simply includes the contents of templatename once.
 
 
 
Any page can be used as a template, by putting a colon (:) at the start of the tag. <nowiki>{{:Help:Templates}}</nowiki> would show the contents of the [[Help:Templates]] page.
 
Also, subpages can be used as templates (or links) directly with a slash (/) then the subpage name. [[Grand Theft Auto IV]] quickly includes it's subpage [[Grand Theft Auto IV/infobox]] with the tag <nowiki>{{/infobox}}</nowiki>.
 
 
*'''[http://www.grandtheftwiki.com/index.php?title=Special%3AAllpages&from=&namespace=10 View all templates]'''
*[[mw:Help:Templates|Help:Templates at MediaWiki]]

Revision as of 20:26, 27 June 2011



Templates are used on Grand Theft Wiki to insert the contents of a template into a page.

This can be used for messages like {{help}}, navigation boxes like {{gta}}, Userboxes, or more complicated templates that take input, such as {{template}}.

Templates are all stored at [[Template:Templatename]]. They can then be included into a page using the code {{templatename}}.

Whatever is on the [[Template:Templatename]] page will then show up in every instance of the {{Name}} tag on Grand Theft Wiki. If you change the template, every page using it will change too.

Templates that require input are used like this: {{templatename | Option 1 | Option 2}}. In the code of the template, those options are referenced as {{{1}}} and {{{2}}} etc. There are also options with specific names, such as {{templatename | title=Hello}}, which is referenced in the template code as {{{title}}}.


For example, {{help}} shows up the banner at the top of this page. It is defined at Template:help. That template shows the banner and also assigns any page it is used on to a category, which is Category:Help. Not all templates do this.


Whenever the template is edited, each page that uses that template will change too. If you just want the template contents copied into the page rather than actively linked, you can use {{subst templatename}}. Subst simply includes the contents of templatename once.


Any page can be used as a template, by putting a colon (:) at the start of the tag. {{:Help:Templates}} would show the contents of the Help:Templates page.

Also, subpages can be used as templates (or links) directly with a slash (/) then the subpage name. Grand Theft Auto IV quickly includes it's subpage Grand Theft Auto IV/infobox with the tag {{/infobox}}.