Template

From Organic Design wiki
Revision as of 01:32, 6 October 2010 by Milan (talk | contribs) (add example)
Glossary.svg This page describes a concept which is part of our glossary

A template is a kind of prototype capturing commonly performed operations which can then be refined for specific use. For example, template documents are commonly used in most organisations for contracts and invoices since they have a large portion of there content which is identical for all of them.

On the web templates are used where ever specific content is found within the same frame or context, for example a "search page template" would contain all the design and layout for a websites search page and would also define where the search results should appear and what style the resulting items have.

Templates are basically just normal articles except that they're expected to be embedded within other articles instead of being viewed as a separate page like a normal article. Because of their role as being a general piece of content to be embedded in other articles it becomes useful to be able to specify various particular information which is specific to that specific context it's appearing in, for example we have a template called Template:Note which is a light-bulb icon in a styled message box, which would be embedded as follows:

{{Note
 | text = Hello!
}}

This embeds the Template:Note article at the location this syntax is used, and it passes one parameter called "text" which contains the actual message which will differ in all the places the template's used. The template article (Template:Note) contains the wikitext to render the styled table with the light-bulb icon, and then specifies where the passes "text" parameter should be placed by using a triple-brace expression, {{{text}}}. Here is what the result looks like:

Note.svg Note: Hello!


In wiki organisation, templates are used in a more specific way relating to forms and queries, see templates, forms and queries for more detail.

See also