Learning: Template Override System

The beauty of the template system is that you only have to change the elements that you want to. If you’re happy with the default templates, then all you need to do is create your own stylesheet to make it look how you want.

If you need to change the html produced, then you can create an override template that the system will use in place of the default template.

You can then decide under what conditions that template will be used. For example you could create an override template that is used for

  • all pages within a section
  • a particular content class
  • a particular node
  • when a user has logged in

To get the system to use an override template, you create and override.ini configuration file and define the conditions for when that override template is to be used. Eg. if we want to use a particular template for all news items, we would include the following block in the override.ini file

# Override for news items [news] Source=node/view/full.tpl MatchFile=news.tpl Subdir=templates Match[class_identifier]=news

This override will then come into play every time a “news” content class is accessed. It will then use the “news.tpl” file in the override folder in the site design.