Master Templates
The inheritance mechanism described in Inheritance in 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 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 solve these
problems.
A master templates has a name of the form:
config.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.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.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.
Let us discuss inheritance of master section with an elaborated example
config.master - config.master.master1 - config.master.master2
If master widget is asked to fetch items from config.master.master2
then
the framework will look for items in the following order :
config.master.master2
config.master.master1
config.master
So we will move upwards in the config section hierarchy until we find config.master. config section will never be consulted unless you are using inherits_from option
If the config section structure is instead the following :
config.master - config.master.master1 - config.master.master2
IF master widget is asked to fetch items from config.master.master2
, then the framework
will look for items in the following order :
config.master.master2
config.master
For detailed instructions on how to create, configure and use widgets, see Widgets.