Skip to the content
Documentation

The Template Editor

No ratings yet

The Template Editor in the administration interface lists the templates of a siteaccess, shows the override rules of each template in the order they are tried, creates and removes overrides, reorders them, changes their conditions, and edits the template files. It writes the siteaccess's override.​ini.​append.​php for you. Open it from the Design tab, left menu Template Editor (/​visual/​templatelist). A user needs the policy visual/templatelist of the Design module (visual/* covers it).

The Template list of the Design tab in the administration interface

Design > Template Editor lists the templates of the siteaccess with the design resource of each one.

The template list

The Template list shows every template of the siteaccess with the design resource it comes from, for example design/​standard/​templates. The filter narrows the list. Click a template to see its overrides.

The overrides of a template

The page of a template (/​visual/​templateview/​<template>) names the default template resource, the template used when no override applies, and lets you choose the siteaccess whose overrides you see. The overrides are shown as cards, 20 per page, in exactly the order they are tried: the first whose conditions all hold is used (see The template override system). Each card shows its position, the rule's name, whether the siteaccess settings or an extension define it, its file and its conditions.

The overrides of node/view/full.tpl as cards in the order they are tried

The overrides of a template in the order they are tried. Each card shows its file and its conditions; drag a card or use its arrows to change the order.

  • Reorder: drag a card by its handle, or move it with its arrows (keyboard and touch work too). The new order is saved at once as the Priority of this template's overrides (10, 20, 30 ...) in settings/​siteaccess/​<siteaccess>/​override.​ini.​append.​php.
  • Change conditions: edit a value and press Save conditions; tick "Remove this condition" to drop one; Add condition offers the match keys of the content view. An empty value removes the condition.
  • Remove selected deletes the selected rules and their template files. Only rules the siteaccess settings define can be removed; an extension's rule belongs to the extension.
  • Edit opens the override's template file in the editor.

A new override

New override opens a form for a new rule of this template:

The form for a new override of node/view/full.tpl

New override: the file, the conditions and the template the new file starts from.

  • Extension and Filename: where the new template file is created, in the override folder of the siteaccess's design.
  • Class, Section, Object ID, Node ID: the conditions. Object ID is the most precise: one object, whatever its location.
  • Base template on: an empty file, a copy of the default template (the drop-down chooses which: by default a class-specific override if there is one, otherwise the source), or a starting point for a container or a plain view.

The new rule gets Priority=0, so it is tried before every other rule of the template and takes effect at once.

Editing a template file

The editor opens a template that the siteaccess uses, either as the default template or as an override's file, in a full-width text area. Save writes the file and expires the content view cache, so the change shows on the site at once; the change is recorded in the audit trail (without the template text). A file the web server cannot write can be opened read only.

The Template Editor with an override template open

Editing an override template of the site in the browser.

Before you use it on a live site

  • The editor changes files on the server. What you change there is not in your version control; changes made by deployment may overwrite it. On a site whose design is deployed from a repository, use the editor on a development installation and commit the result.
  • Templates of design/standard/ and of extensions are replaced on upgrades: make an override in your own design instead of editing them.
  • Keep a copy of the file before bulk changes. The editor keeps a copy of override.​ini.​append.​php before it writes, and checks the file afterwards.

Every detail of the reordering, the paging and the safety checks: Template editor: create, order and edit overrides. A walkthrough that makes and removes an override: Templates and design.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.