Skip to the content
Documentation

System templates

No ratings yet

A system template is the template of any view that does not show a content node: signing in, searching, the basket, the user's settings, the error pages and every page of the administration interface. Its path is usually the module name and the view name: the login view of the user module renders user/login.tpl, and the search view of the content module renders content/search.tpl.

Two things set system templates apart from node templates:

  • Each view gives its template the variables it needs (a search view gives the search result, the login view the form state); there is no $node.
  • Override rules for system templates have few conditions or none, because the view sets few match keys. Customizing them is usually done by copying the template into your own design.

Customizing a system template

The standard design has a template for every view. To change one, copy it from design/​standard/​templates/ to the same path below templates/ of your design, and change the copy. Your design comes before the standard design in the design chain, so your copy is used:

mkdir -p design/example/templates/user
cp design/standard/templates/user/login.tpl design/example/templates/user/login.tpl

Such a copy goes in templates/, not in override/templates/, and needs no rule in override.ini. Clear the template caches once after adding a file at a new path (see Template caching).

Commonly changed system templates

Page Address Template
Search /content/search content/search.tpl
Advanced search /​content/​advancedsearch content/​advancedsearch.​tpl
Basket /shop/basket shop/basket.tpl
Sign in /user/login user/login.tpl
Registration /user/register user/register.tpl

To see which templates a page uses, switch on the list of used templates or the template path comments (see Debugging templates). Which variables a view gives its template is described per module in Module view templates.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.