Content Templates
Content templates provide a way to ensure new content is created using a standardised style/layout which is particularly important when a Tiki system has multiple editors. They can also allow complex new content to be created to an initial stage both quickly and consistently.
Each template is just a block of static HTML markup or wiki syntax and other text, images etc., that can be created using either the standard wiki editor or the WYSIWYG editor, and can then be applied as starting content when creating tiki objects. The following objects currently use content templates:
- Wiki pages (HTML format or wiki format)
- Articles or submissions
- Newsletters
Activate the feature
- Wiki pages:
- You can enable them in Control Panels > Wiki > General Preferences (tab) >Editing (section) > Wiki content templates
- You may want to enable there also the other option: Lock Content Templates
- Articles or submissions:
- You can enable them in Control Panels > Articles > General Settings (tab) >Features (section) > Article content templates
- You may want to enable there also the other option: Lock Content Templates
- Newsletters:
- You can enable the Wiki content template to create a template for newsletters, through a wiki page, or through a standalone text area.
- Once you have newsletters enabled, and one newsletter defined, when you go to compose a newsletter for sending, you will be able to select content templates.
Use it
To create or edit a content template, follow the "Content templates" link from the admin section of the application menu (called the Settings menu from Tiki14 onwards). It will take you to tiki-admin_content_templates.php
When a new template is created not only is the content defined but whether the template can be used in Articles, Wiki pages or Newsletter is configured by a series of checkboxes.
The content itself is either created in the edit section of the screen (using either the standard wiki editor or the WYSIWYG editor) - this is the 'Text area' option in the 'Template Type' field - or it can be 'referenced' by providing the name of an existing wiki page - this is the 'Wiki Page' option in the 'Template Type' field .
The details of the individual screens are shown below:
In Tiki14, and earlier versions, there is a single admin screen as shown above where a new template can be defined in the top section and the bottom section tabulates the existing templates allowing them to be 'selected' for re-editing if required.
From Tiki15 onwards the Content template admin screen is separated into two individual 'Templates' and 'Create template' tabs, each of which is illustrated above.
Categorisation is now also allowed from Tiki15 onwards so that access to individual templates can be restricted to designated Groups by the usual categorisation process. In the 'Create template' tab there is now a Categorize section to allow individual categories to be selected in the usual checkbox manner and in the 'Templates' tab an additional column now shows which categories the existing templates have been assigned to, if any.
In addition from Tiki15 onwards, a Content template can now be locked with a clickable icon shown, when appropriate, in both the 'Templates' listing table and the edit screen for each template.
Once a template is created, editors will be able to apply it when editing an object of the type that the template has been specified for.
If a content template is applied to an existing object that already has content, the content template will be pasted in at the beginning of the page but won't overwrite the existing content.
The content template that is applied to any particular page is a copy of the original. Once applied, the content template becomes part of the page, article, etc., and can be edited as freely as the rest of the object. If the content template original changes, the Tiki objects that used the earlier version of the template are not changed.
The template has to be chosen each time a new page is created, there is no way to pick a different default entry other than "none" (but there is an openrequest for an enhancement).
Further details
Further details of how templates are used are provided in the User Guide at Using Content templates.