WikiIslam:Templates: Difference between revisions

From WikiIslam, the online resource on Islam
Jump to navigation Jump to search
mNo edit summary
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
In a wiki website, templates are great ways to save time by reusing content. They are just like regular pages except that their page name begins with the keyword "Template:". For example see [[Template:Stub]]
Templates are an effective way of [[WikiIslam:Standardization|standardizing content]]. They are like regular wiki pages except that their page name begins with the keyword "Template:" (e.g. [[Template:Stub]])
A Stub template can be included on a stub page (a page that needs more content) by simple insert <nowiki>{{</nowiki>stub}} on the page. Notice that we left out the keyword (Template:) and surrounded the name of the template page with double curly brackets. Mediawiki calls this a transclusion ([http://www.mediawiki.org/wiki/Transclusion more info]).


Try including a template right now in the [[WikiIslam:Sandbox|Sandbox]] page by insert <nowiki>{{</nowiki>stub}} in the page and saving or previewing it. Templates can also be flexible when they use variables. For example writing <nowiki>{{</nowiki>Quran|2|131}} will use the two variables to make a link to that part of the Quran. The result is this: {{Quran|2|131}}. Another example of a templates that uses variables: [[Muhammad and History's 100 Most Influential People]]. Here the box at the right uses a template. You can see the code for that box by clicking edit.
A Stub template can be included on a stub page (a page that needs more content) by simply inserting <nowiki>{{</nowiki>stub}} on the page. Notice that the keyword (Template:) has been left out and the name of the template page has been surrounded with double curly brackets. Mediawiki calls this a transclusion ([http://www.mediawiki.org/wiki/Transclusion more info]).


Templates can be used to produce small pieces of text like {{Quran|2|131}} or a large piece of content such as the [[Template:QuranHadithScholarsIndex|Index]] table for the Quran, Hadith and Scholars pages. If a page contains templates, clicking the Edit link will show you a list of all templates used on that page at the bottom of the editing interface.
Editors can practice including templates on a page by using the [[WikiIslam:Sandbox|Sandbox]] (insert <nowiki>{{</nowiki>stub}} in the page and save or preview it). Templates can also be flexible when they use variables. For example writing <nowiki>{{</nowiki>Quran|2|131}} will use the two variables to make a link to that part of the Qur'an. The result is this: {{Quran|2|131}}. Another example of a templates that uses variables: [[Muhammad and Historys 100 Most Influential People|Muhammad and History's 100 Most Influential People]]. Here the box at the right uses a template. The code for that box can be seen by clicking edit.


Just like a regular page, links to a template page (like we have made on this page) can be made using square brackets, for example <nowiki>[[</nowiki>Template:Stub]] produces: [[Template:Stub]]
Templates can be used to produce small pieces of text like {{Quran|2|131}} or a large piece of content such as the [[Template:QuranHadithScholarsIndex|Index]] table for the Qur'an, Hadith and Scholars pages. If a page contains templates, clicking the Edit link will show a list of all templates used on that page at the bottom of the editing interface.
 
Like a regular page, links to a template page (like the ones on this page) can be made using square brackets, for example <nowiki>[[</nowiki>Template:Stub]] produces: [[Template:Stub]]


==Templates with Variables==
==Templates with Variables==
Templates that accept variables are a great way to let the software take care of formatting issues. For example if you're putting in a reference to a website, you can use the [[Template:Cite web|Cite web]] template. Just enter the URL, URL Title, author, publisher and archive URL and it will know how to format the output. So for example you wont have to worry about whether the author is mentioned first in that reference.
Templates that accept variables are a way to let the software take care of formatting issues. For example when putting in a reference to a website, the [[Template:Cite web|Cite web]] template can be used. All that is needed is the URL, URL Title, author, publisher and archive URL and it will automatically format the output. So, for example, editors would not have to worry about whether the author is mentioned first in that reference.


Using variables also makes sure that formatting remains consistent in all those occurrences of cite web. Otherwise if you do it manually, sometimes you may mention the author at the end of the rereference and at other times it may be in the beginning. Templates will make sure the output is consistent.
Using variables also makes sure that formatting remains consistent in all those occurrences of cite web. If the formatting was inputted manually, editors may place the author at the end of the reference and at other times place them at the beginning. Templates will make sure the output is consistent.


They also enable us to make system wide changes easily. The [[Template:Quran|Quran]] template also uses variables and has been updated multiple times when source websites had to be updated. System wide changes were made instantly which would be almost impossible to make if a template had not been used.
They also enable easy system-wide changes. The [[Template:Quran|Qur'an]] template also uses variables and has been updated multiple times when source websites had to be updated. System wide changes were made instantly which would be almost impossible to make if a template had not been used.


Any time you're formatting text in a certain way (for example: "''date, author - URL (website title)''"), that means it can usually be done through templates.
Any time an editor is formatting text in a certain way (for example: "''date, author - URL (website title)''"), that means it can usually be done through templates.
 
For an example of a template that uses a simple type of input and produces a different output, see: [[Template:Tabari]]


[[Template:Tabari]] is an example of a template that uses a simple type of input and produces a different output.


Here are some templates that can be used on the website.
Here are some templates that can be used on the website.
Line 25: Line 25:
* [[Template:Stub]] - for short articles that need expansion
* [[Template:Stub]] - for short articles that need expansion
* [[Template:Underconstruction]] - page under construction
* [[Template:Underconstruction]] - page under construction
* [[Template:Quality control]] - articles that do not meet our quality standards (content, style etc)
* [[Template:Quality control]] - articles that do not meet quality standards (content, style etc)


==Misc Templates==
==Misc Templates==
* [[Template:Merge]] - for proposing merging of pages (also see [[Template:Mergefrom]] and [[Template:Mergeto]])
 
* [[Template:Essay]] - for putting an essay box at the top right of a page. This is used for pages
* [[Template:Essay]] - for putting an essay box at the top right of a page. This is for op-ed type pages that contain personal opinions
* [[Template:Essay]] - as the template box says, this is for op-ed type pages that contain personal opinions
* [[Template:Flag|Flag]] - produces a flag icon for a country.
* [[Template:Flag|Flag]]: Produces a little flag icon for a country.
* [[Template:Spaces]] - inserts blank spaces in text
* [[Template:Spaces]] - insert blank spaces in text
* [[Template:Small]] - small text
* [[Template:Small]] - small text
* [[Template:Fontcolor]] - used to change font color when needed
* [[Template:Fontcolor]] - used to change font color when needed
* [[Template:New]] - produces a little "new" icon/image
* [[Template:New]] - produces a "new" icon/image
* [[Template:Page title]] - used to change the heading of a page, since page names should ideally not contain brackets, commas and some other characters. Some websites and forums break links with these characters in them. With this template you can have a 'safe' URL with any page heading.
* [[Template:Page title]] - used to change the heading of a page, since page names should ideally not contain brackets, commas and some other characters. Some websites and forums break links with these characters in them. This template produces a safe URL with any page heading.
* For Templates relating to Islamic texts see [[WikiIslam:Standardization]]
* [[WikiIslam:Standardization]] - for templates related to Islamic texts


==Reference==
==References==
* [[Template:Reflist]] - produces a Reference list at the bottom of an article when references (<nowiki><</nowiki>ref> tags) are used in an article
* [[Template:Reflist]] - produces a reference list at the bottom of an article when references (<nowiki><</nowiki>ref> tags) are used
* [[Template:Reference archive]] - used for links to WebCitation.org, which is used for preserving links in the long term
* [[Template:Reference archive]] - used for links to WebCitation.org, which is used for preserving links in the long term


==Books and People==
==Books and People==
* [[Template:Infobox Book]] - for pages that are about books
* [[Template:Infobox Book]] - for pages that are about books
* [[Template:Infobox Person]] - for pages that are about books
* [[Template:Infobox Person]] - for pages that are about a person


==Links and Navigation==
==Links and Navigation==
* [[Template:Plainlink|Plainlink]]: This makes a plain link to a site with out having that little arrow graphic ([http://en.wikipedia.org &nbsp;])&nbsp; in the way.
* [[Template:Plainlink]] - this makes a plain link to a site without having an arrow graphic ([http://example.com/ &nbsp;])&nbsp; in the way.
* [[Template:Wikipedia]] - link to a named Wikipedia article
* [[Template:Pagetop]] - makes a link to the top of a page
* [[Template:Pagetop]] - makes a link to the top of a page


==Communicating with Users==
==Communicating with Users==
;Welcoming new members
Click on a new member's talk page and it will prompt you for creating a new page. Place this in the edit box and save the page:
:<nowiki>{{</nowiki>subst:New Member}}
This will place (substitute) a welcome template on their talk page with your username. The template used here is [[Template:New Member]].


; Users with IP addresses
* [[Template:New Member]] - this will place (substitute) a welcome template on talk pages with the username of the editor who placed it there
* [[Template:Unsigned]] - for IP address users who did not sign their comment on a talk page.
* [[Template:Unsigned]] - for users who did not sign their comment on a talk page


==Writing Templates==
==Writing Templates==
Line 67: Line 61:


===Programming in Templates===
===Programming in Templates===
* [[Template:Qif|Qif]]: A template which allows you to make IF statements, similar to how they're used in programming languages.
* [[Template:Qif]] - allows IF statements, similar to how they are used in programming languages
* [[Template:Loop]] - From [http://en.wikipedia.org/wiki/Template:Loop Wikipedia], "This template is used to produce a simple loop that can repeat up to 150 times. It is not a real loop; it works by conditionally repeating the string."
* [[Template:Loop]] - from [http://en.wikipedia.org/wiki/Template:Loop Wikipedia], "This template is used to produce a simple loop that can repeat up to 150 times. It is not a real loop; it works by conditionally repeating the string."
* [[Template:Pipe]] - used inside a template to produce a pipe: |
* [[Template:Pipe]] - used inside a template to produce a pipe: |
* [http://en.wikipedia.org/wiki/Wikipedia:Anatomy_of_a_template Wikipedia:Anatomy of a template]
* [http://en.wikipedia.org/wiki/Wikipedia:Anatomy_of_a_template Wikipedia:Anatomy of a template]

Revision as of 22:14, 1 March 2014

Templates are an effective way of standardizing content. They are like regular wiki pages except that their page name begins with the keyword "Template:" (e.g. Template:Stub)

A Stub template can be included on a stub page (a page that needs more content) by simply inserting {{stub}} on the page. Notice that the keyword (Template:) has been left out and the name of the template page has been surrounded with double curly brackets. Mediawiki calls this a transclusion (more info).

Editors can practice including templates on a page by using the Sandbox (insert {{stub}} in the page and save or preview it). Templates can also be flexible when they use variables. For example writing {{Quran|2|131}} will use the two variables to make a link to that part of the Qur'an. The result is this: Quran 2:131. Another example of a templates that uses variables: Muhammad and History's 100 Most Influential People. Here the box at the right uses a template. The code for that box can be seen by clicking edit.

Templates can be used to produce small pieces of text like Quran 2:131 or a large piece of content such as the Index table for the Qur'an, Hadith and Scholars pages. If a page contains templates, clicking the Edit link will show a list of all templates used on that page at the bottom of the editing interface.

Like a regular page, links to a template page (like the ones on this page) can be made using square brackets, for example [[Template:Stub]] produces: Template:Stub

Templates with Variables

Templates that accept variables are a way to let the software take care of formatting issues. For example when putting in a reference to a website, the Cite web template can be used. All that is needed is the URL, URL Title, author, publisher and archive URL and it will automatically format the output. So, for example, editors would not have to worry about whether the author is mentioned first in that reference.

Using variables also makes sure that formatting remains consistent in all those occurrences of cite web. If the formatting was inputted manually, editors may place the author at the end of the reference and at other times place them at the beginning. Templates will make sure the output is consistent.

They also enable easy system-wide changes. The Qur'an template also uses variables and has been updated multiple times when source websites had to be updated. System wide changes were made instantly which would be almost impossible to make if a template had not been used.

Any time an editor is formatting text in a certain way (for example: "date, author - URL (website title)"), that means it can usually be done through templates.

Template:Tabari is an example of a template that uses a simple type of input and produces a different output.

Here are some templates that can be used on the website.

Articles that Need Attention

Misc Templates

  • Template:Essay - for putting an essay box at the top right of a page. This is for op-ed type pages that contain personal opinions
  • Flag - produces a flag icon for a country.
  • Template:Spaces - inserts blank spaces in text
  • Template:Small - small text
  • Template:Fontcolor - used to change font color when needed
  • Template:New - produces a "new" icon/image
  • Template:Page title - used to change the heading of a page, since page names should ideally not contain brackets, commas and some other characters. Some websites and forums break links with these characters in them. This template produces a safe URL with any page heading.
  • WikiIslam:Standardization - for templates related to Islamic texts

References

  • Template:Reflist - produces a reference list at the bottom of an article when references (<ref> tags) are used
  • Template:Reference archive - used for links to WebCitation.org, which is used for preserving links in the long term

Books and People

Links and Navigation

Communicating with Users

  • Template:New Member - this will place (substitute) a welcome template on talk pages with the username of the editor who placed it there
  • Template:Unsigned - for users who did not sign their comment on a talk page

Writing Templates

Wikipedia has many templates that can be used here. Templates can be written using the page title format Template:My template. This template can then be used on a page using this notation: {{My template}}

Documentation: As on Wikipedia, documentation for templates can be written on the page: Template:My template/doc, if the code {{Documentation}} has been included in the template.

Programming in Templates

See Also

  • Full list of all templates (system generated; Note that many templates are used for very specific group of articles and some templates have more complex uses)