This is a detailed description of reaction's template system.




Reaction's templates are organized into sets called skins. A skin is defined by a directory containing several template files and static assets. Skins live in directories under the share/skin path in your application distribution. Each directory and the template files within compose their own skin. Templates live in the layout directory and assets live in the web directory.

Core Skins

Reaction provides prebuilt skins called base and default. These provide the basic html components for a typical web application, such as forms, fields and table list views. Skins are extensible, which means you can include all the templates from another skin within your custom skin through a configuration directive instead of copying template files, making your template setup easy to maintain.

Configuration Directives

The share/skin/defaults.conf file holds general application-wide skin configuration. Each skin can be configured individually by placing a skin.conf file in it's root directory.

  • extends $skin_name

    Defines $skin_name as the base skin.


Template files are sets of pod-like directives which define a set of layouts. They are used for the sole purpose of describing how the data is to be layed out at render time. Each template file contains a set of layout definitions which are used by reaction widgets to generate the final content. Variables are defined and populated in the widgets then passed to the layout fragments in a given template file.

Template Directives

  • =for layout $fragment_name

    Defines a layout fragment called $fragment_name, everything under the directive up to the next fragment directive is part of the definition. By default, variables with the same name as an existing layout definition are rendered as the equivalent layout. Widgets might interfere and select an alternate layout or template to be rendered instead. A templates' rendering process always starts by a layout called widget.

  • =extends $template_name

    Makes the current template inherit the layout definitions in $template_name. Layouts defined in the template override the ones in the base template. The special NEXT template name specifies that inheritance should use the equivalent template from the base skin as configured in skin.conf.

  • =widget $widget_name

    Selects $widget_name as the driver for the current template.



A layout definition creates a variable scope attached to that layout. Variables only exist within their specific layout fragments, that is, they are scoped to specific layouts. Overriding a layout places it in the same scope as the base layout.

Using layouts defined in base templates

The special [% call_next %] variable will be replaced by the layout in the base template within the same scope.