Normally a "template" is a HTML-file that describes a layout and certain areas that should be substituted with some other content. In Typo3 you can use this approach, even with TypoScript. See the tutorials for more information.
But a "template" or "template record" as refered to in these documents is a record from the database table "sys_template" in Typo3 and the existence of such a record on a certain page defines how the page displays. Thats a template.
In order to understand templates, you should read this introduction to TypoScript. You'll also find thorough information in the TSref.
This page is an overview of the fields of the template-table:
"Template title": The title of the template. This is shown in the recordlist on the web-tab. Choose whatever you like.
"Website title": This is the title of the entire website. This is shown in the HTML-title before the page-titles. Look at this website (typo3): In the titlebar of the browserwindow "Typo3:" is prepended the title of the specific page.
"Constants": The "Constants-field". This is where you put constants that is substituted in the setup-field. Eg. a constant "styles.content.textStyle.size" is inserted in the setup-field as "{$styles.content.textStyle.size}". Constants are substituted in the order they are introduced in this field. It is important to understand that constants are not used as programming variables. They only substitute constants items in Setup. Note that the Constants-field is "summed-up" (concatenated) with previous templates in the rootline and constants-fields from included templates (see below "Clear" (6)).
"Setup": This field contains the TypoScript setup-code. Use constants from the "Constants-field" (3) to insert easily changable properties or global values. Note that the Setup-field is "summed-up" (concatenated) with previous templates in the rootline and Setup-fields from included templates (see below "Clear" (6)).
"Resources": This field may contain media like images, masks, truetype-fonts, stylesheets, html- and text-documents. These can be referenced from within TypoScript (Datatype "resource") and are copied with templates.
When you create a reference to a "resource" do like this: "image*.gif" instead of this: "image.gif". If you use the asterisk, you prepare your template for duplication as "image*.gif" will also match a filename like "image_01.gif" which will be produced when a template is duplicated.
"Clear" and "Rootlevel": "Clear" lets you clear the Constants and/or Setup code of template from earlier in the rootline. For a deeper explanation of this, refer to the TSref.
"Rootlevel" defines, that this point in the page-structure should act as the root (the startpage) of a new website.
"Include static": This lets you include the static templates that comes with Typo3 by default. The order (from top) is the order by which, the templates are included. Static templates are included before the template in the field "Include basis template" (8).
"Include basis template": Here you can include other templates, which you have made yourself. See the case below.
"Template on next level": Here you can include a template that will be included for pages on the next level in the tree-structure!
"Description": Enter your own notes here.
A nice way to use templates is to create libraries of TypoScript code in a template and then include that template in another template an reuse the TypoScript code. This is the point of static templates.
But static templates cannot be edited. They are distributed with Typo3 and are not subject to change. Only subject to "expand" (new static templates will be written by time). Therefore you have the ability of including templates in templates.
In this example I'll show you how I made the www.typo3.com and www.typo3.dk websites. They are very much alike. Therefore I have created a common template to control the design. But I have also made individual "extensions" with respect to the danish and english language.
In order to share a template between two or more sites, the sites must reside in the same database. This is the case of the Typo3 website in the two languages. The advantages of this is very obvious: All graphics, pages and layout are easy to copy around and maintain when they are accessible from the same Typo3-interface.
Look at the first picture below (click it for a separate window). In the "rootpage" of both the ".com" and ".dk" site there's a template (with "Rootlevel" clicked). Each template includes the main template, which is found in the "Skabeloner"-folder (means "templates" in danish...). The main template controls almost the entire layout of the sites. And each site share this template!!
Now look at the second and third picture below. These are parts of the content in each of the ".com" and ".dk" templates. Here you see some values being overridden. For each site the content of the meta-tags "keywords" and "description" is different. The proper constants are therefore overridden in order to change this. You will also notice that the danish template changes a few other parameters.
This is very interesting. Local changes are possible in one branch of the website while the global layout may still be changed from the main template. This is pretty much how you can utilize the standard templates. They have a set of constants, you may alter in order to customize you site.
You can easyly monitor which templates are included for your site by the Template Analyzer function in the web_ts module:
This shows not only which templates and static_template are included but also in which order (read "from top") they are processed and if any of the templates has switches set like "Clear constants" and "Clear setup".
The above examples indirectly showed the strength of extensions; The site-specific changes was extensions (overridden TypoScript or constants) of the main template.
Here I'll show you how the FAQ-pages in the developer-section of this website is created:
First of all I use another kind of header for the FAQ-section. This headertype has a grey box around and you may choose this header for content-items whereever on the site ("Layout 2"). But the default header type is "Layout 1". So for the FAQ-section (the "blueish" pages on the first picture below) I made an extension, that the default header type should be "2" and not "1" for all pages in this section - which means "all pages from FAQ and outwards".
The task is done by creating a new template on the "FAQ"-page. In this template the "Clear"-fields and "Rootline" must not be checked. If they are, the whole website will "start over" from that point instead of being an extension to the original template!
The content of the template is shown on the second picture. As you see the default header type is set to "2" and the default bodytext size is set to "1" (normally "2").
Of course I could change the font-size and header-type for each content-item... but frankly, that's a quite boring way to do it, if you can fix it like this...
Check the FAQ-section and see for yourself! It works. No hassle.