Master Templates
The inheritance mechanism described in
Inheritance in the Widget Framework provides a useful
means of re-using groups of widgets. It only works, however, for
whole areas. You can, for example, re-use the whole
of a template's Main
area by creating a child
template with an empty Main
area. But what if you
only want to re-use one particular group of widgets, not the whole area?
What if you want to re-use a group of widgets from a template other than
the parent of the template you are working on? Master templates provide
a more flexible means of re-using groups of widgets that solves these
problems.
A master template has a name of the form:
config.default.master.
master-template-name
and contains a set of templates that you want to be able to re-use. You might, for example, create a menu that you want to re-use in many of your templates.
Once you have created a master template containing the widgets you want
(let's call it config.default.master.menu
), you can
use it by creating a master
widget and placing it in
any section and/or article templates you like. A
master
widget has two required properties:
- Title
-
The name of the widget instance you have created. You might set this to
Menu
. - Master section unique name
-
The name of the master template this widget is to reference. You would set this to
config.default.master.menu
in this case.
Set these properties, save the widget, and then drag it into the templates where you want to use the widget group defined in the master template.
For a description of how you can enable editorial staff to quickly switch between master templates, see Enable Master Template Switching.