Help:Templates
From AcmlmWiki
Templates are articles with the prefix Template:. They work in the same manner as normal pages, except you can add them to an article by using the syntax {{TemplateName}}.
Note that you can create templates in the User: namespace (or any other namespace) by creating a page named User:Username/Template:Whatever, and then include them using {{User:Username/Template:Whatever}}. This is preferred for templates which are not important to AcmlmWiki.
Contents |
[edit] Ready-made templates
Other people have already made some templates. A list of these ready-made templates can be found here.
[edit] Creating a template
Creating a template is similar to creating a article: write the code, and submit it. But this time, everything you write here will be shown when you insert a template in an article. If you want to write some notes, read below.
[edit] <includeonly> and <noinclude>
These two tags have a special meaning in template pages. Basically everything inside <includeonly> tags will only be displayed/parsed when including this template, everything inside <noinclude> will be only shown on the template page, and code that isn't in either of these will be shown on both the template page and the included template. This can be used to add notes/comments to the template page, or to add pages that have this template included in a special category (but not the template page itself).
[edit] Parameters
You can also require parameters for your template. Parameters are basically variables. If you need only one parameter, insert {{{1}}} where you want your parameter. To define the parameter, insert the template with this code:{{TemplateName|ParameterValue}}
Example of using one parameter in template code: It has been requested that this article be merged with [[{{{1}}}]].If you need multiple parameters, it gets complicated. Template:User Infobox is a good example of multiple parameters.
[edit] Substitution
Since the new MediaWiki 1.9.2 got installed, you have the additional option to substitute a template. Substituting inserts the content of the template in the article, instead of keeping the {{template}} link in the source. It's required for most templates which use changing variables, and preferred for templates used for newbies. Some templates do not work with substitution at all, so watch out!
To substitute a template, add a subst: before the template name, i. e. {{subst:template}}. The template source will be added to the page as soon as you save it.
[edit] Predefined Templates
Predefined templates are templates which are defined by the MediaWiki software. They are in most cases variable, and should be substituted.
[edit] Templates referring to the page, or server
- {{PAGENAME}} - The name of the current page.
- {{PAGENAMEE}} - The name of the current page, encoded URL-style.
- {{SUBPAGENAME}} - The name of the current subpage.
- {{SUBPAGENAMEE}} - The name of the current subpage, encoded URL-style.
- {{BASEPAGENAME}} - The name of the current base page(s).
- {{BASEPAGENAMEE}} - The name of the current base page(s), encoded URL-style.
- {{NAMESPACE}} - The name of the current namespace.
- {{NAMESPACEE}} - The name of the current namespace, encoded URL-style.
- {{FULLPAGENAME}} - The full page name, including namespace. Same as {{NAMESPACE}}{{PAGENAME}}.
- {{FULLPAGENAMEE}} - The full page name, including namespace, encoded URL-style. Same as {{NAMESPACE}}{{PAGENAME}}.
- {{TALKSPACE}} - The name of the talk page's namespace.
- {{TALKSPACEE}} - The name of the talk page's namespace, encoded URL-style.
- {{SUBJECTSPACE}} or {{ARTICLESPACE}} - The name of the article's namespace (opposite of the above).
- {{SUBJECTSPACEE}} or {{ARTICLESPACEE}} - The name of the article's namespace (opposite of the above), encoded URL-style.
- {{TALKPAGENAME}} - The {{FULLPAGENAME}} of this article's talk page.
- {{TALKPAGENAMEE}} - The {{FULLPAGENAME}} of this article's talk page, encoded URL-style.
- {{SUBJECTPAGENAME}} or {{ARTICLEPAGENAME}} - The {{FULLPAGENAME}} of this talk page's article (opposite of the above).
- {{SUBJECTPAGENAMEE}} or {{ARTICLEPAGENAMEE}} - The {{FULLPAGENAME}} of this talk page's article (opposite of the above), encoded URL-style.
- {{REVISIONID}} - The current revision ID. (empty while editing)
- {{REVISIONDAY}} - The day this page was last modified.
- {{REVISIONDAY2}} - The day this page was last modified, with a leading zero.
- {{REVISIONMONTH}} - The month this page was last modified.
- {{REVISIONYEAR}} - The year this page was last modified.
- {{REVISIONTIMESTAMP}} - Timestamp of the current revision.
- {{SITENAME}} - The name of this Wiki.
- {{SERVER}} - The address of this Wiki.
- {{SCRIPTPATH}} - The script path of this Wiki.
- {{SERVERNAME}} - The name of this server.
[edit] Templates referring to time
The following variables refer to UTC time.
- {{CURRENTDAY}} - The current day.
- {{CURRENTDAY2}} - The current day, with a leading zero.
- {{CURRENTDAYNAME}} - The name of the current day.
- {{CURRENTDOW}} - The number of the current day within a week.
- {{CURRENTMONTH}} - The current month.
- {{CURRENTMONTHABBREV}} - Abbreviated version of 05
- {{CURRENTMONTHNAME}} - The name of the current month.
- {{CURRENTTIME}} - The current time.
- {{CURRENTHOUR}} - The current hour.
- {{CURRENTWEEK}} - The current week,
- {{CURRENTYEAR}} - The current year.
- {{CURRENTTIMESTAMP}} - The current timestamp.
The following variables refer to the timezone the Wiki runs in.
- {{LOCALDAY}} - The local day.
- {{LOCALDAY2}} - The local day, with a leading zero.
- {{LOCALDAYNAME}} - The name of the local day.
- {{LOCALDOW}} - The number of the local day within a week.
- {{LOCALMONTH}} - The local month.
- {{LOCALMONTHABBREV}} - Abbreviated version of 05
- {{LOCALMONTHNAME}} - The name of the local month.
- {{LOCALTIME}} - The local time.
- {{LOCALHOUR}} - The local hour.
- {{LOCALWEEK}} - The local week,
- {{LOCALYEAR}} - The local year.
- {{LOCALTIMESTAMP}} - The local timestamp.
[edit] Templates referring to the statistics
Add an :R after the variable name to remove thousands separators.
- {{CURRENTVERSION}} - The current version of this Wiki.
- {{NUMBEROFARTICLES}} - The number of articles in the Wiki.
- {{NUMBEROFPAGES}} - The number of pages in the Wiki.
- {{NUMBEROFFILES}} - The number of files in the Wiki.
- {{NUMBEROFUSERS}} - The number of registered users in the wiki,
- {{NUMBEROFADMINS}} - The number of sysops in the wiki.
| AcmlmWiki Help | |
|---|---|
|
Basic editing | Links and Images | Tables | HTML | Talk Pages | Templates |
