GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Reaction::Manual::Templates(3) User Contributed Perl Documentation Reaction::Manual::Templates(3)

Reaction::Manual::Templates

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

Organization

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.

Scope

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.

2010-10-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.