Changes

Jump to navigation Jump to search
18 bytes added ,  15:47, 14 November 2013
m
added link
{{Help article}}
 <br> If you have standard texts you want to include on several pages, the MediaWiki template feature comes into play.
=== Creation ===
Templates are standard wiki pages whose content is designed to be [[Help:Transclusion|transcluded]] (embedded) inside other pages. Templates follow a convention that the name is prefixed with "<code>Template:</code>", assigning it to that namespace. Therefore you can [[Help:How to create an article|create them like any other wiki page]].
=== Usage ===
==== Parameters ====
<div style="float:right; margin:8px;">
{| {{Prettytable}}
|-
|{{Hl2}} colspan="2" align="center" |'''Template with numbered parameters'''
|-
| colspan="2" |<pre><nowiki> '''A little thank you...'''<&lt;br />&gt;<&lt;small>&gt;for {{{1}}}.<&lt;br />&gt;hugs, {{{2}}}<&lt;/small>&gt;</nowiki></pre>
|-
|{{Hl2}}|'''You type''' |{{Hl2}}|'''You get'''
|-
|<code><nowiki>{{Thankyou|all your hard work|Joe}}</nowiki></code>|{{Thankyou|all your hard work|Joe}} 
|-
|{{Hl2}} colspan="2" align="center" |'''with named parameters'''
|-
| colspan="2" |<pre><nowiki> '''A little thank you...'''<&lt;br />&gt;<&lt;small>&gt;for {{{reason}}}.<&lt;br />&gt;hugs, {{{signature}}}<&lt;/small>&gt;</nowiki></pre>
|-
|{{Hl2}}|'''You type''' |{{Hl2}}|'''You get'''
|-
|<pre><nowiki>{{Thankyou|&#124;reason=all your hard work|&#124;signature=Joe}}</nowiki></pre>|{{Thankyou|all your hard work|Joe}} 
|}
</div>
<br>You can define parameters in templates either numbered as <code><nowiki>{{{1}}}</nowiki></code> or named <code><nowiki>{{{param}}}</nowiki></code>. Please note that there are a set of three curly braces (<code><nowiki>{{{</nowiki></code> and <code><nowiki>}}}</nowiki></code>) around each parameter. This is different than normal template name usage.
'''Example:''' You want a little thank you note you can put on the talk page of other users. It will contain a reason and your signature. You could create [[Template:Thankyou]] to enter your text, as in the example in the table.
The converse is <code><nowiki><includeonly></nowiki></code>. Text between <code><nowiki><includeonly></nowiki></code> and <code><nowiki></includeonly></nowiki></code> will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a [[Help:Categories|category]], without putting the template itself into that category.
{{Note|When you change the categories applied by a template, the categorization of the pages that use that template may not be updated until some time later: this is handled by the {{mediawiki|Manual:Job queue|job queue}}.}}
==== Documentation ====Documentation for users, together with the template's categories are normally placed after the template code, inside "noinclude" tags. It is normally necessary to put the opening "noinclude" tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace.
Documentation for users, together with the template's categories are normally placed after the template code, inside "noinclude" tags. It is normally necessary to put the opening "noinclude" tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace.  In the case of complex templates, the documentation (together with categories and wikilinks) is often kept on a separate [[Help:Subpages|subpage]] of the template page (named "Template:XXX/doc"). This also applies to many [[Help:Protected pages|protected]] templates (to allow the information to be edited by non-administrators). This is achieved by placing the {{tl|Documentation}} template after the main template code (within "noinclude" tags). If the "/doc" subpage does not exist, a link will then appear enabling it to be created.
==== Organizing templates ====
&lt;/noinclude&gt;
</pre></div>
Then, an editor can simply copy and paste the example to create a similar page.
== Copying from one wiki to another ==
#Go to [[Special:Import]] on the new wiki and upload the .xml file.
#Look for CSS classes (like class="foobar") in the template text. If those classes appear in "MediaWiki:Common.css" or "MediaWiki:Monobook.css" on the original wiki, copy them to "MediaWiki:Common.css" on the new wiki.
#If the template uses [[Help:Magic_wordsMagic words#Parser_functions|ParserFunctions]], you have to install the {{mediawiki|Extension:ParserFunctions|ParserFunctions extension}}.
=== If you don't have import rights on the new wiki ===
#Edit the template on the new wiki, and look through the list of templates at the bottom. The ones in red will also need to be copied from the original wiki to the new wiki. You may have to repeat this process multiple times before all dependency templates have been recognized and copied.
#Look for CSS classes (like class="foobar") in the template text. If those classes appear in "MediaWiki:Common.css" or "MediaWiki:Monobook.css" on the original wiki, copy them to "MediaWiki:Common.css" on the new wiki.
#If the template uses [[Help:Magic_wordsMagic words#Parser_functions|ParserFunctions]], you must install the {{mediawiki|Extension:ParserFunctions|ParserFunctions extension}}.
== See also ==
{{Contributor help-navbox}} {{Editing help}}
 
{{H-langs|es=Ayuda:Plantillas|en=Help:Templates}}
[[Category:Templates]] [[Category:Help|{{PAGENAME}}]]
Moderator, Reviewer, editor, pagecreator, Administrators
1,973

edits

Navigation menu