Using template files

Instead of defining your templates in inline text, you can store a Gosu template as a separate file. Template files support all the features that inline templates support. In addition, template files provide additional advantages and features:
Separate your template definition from code that uses the template
For example, define a template that generates a report or a notification email. You can then call this template from many places but define the template only once.
Encapsulate your template definition for better change control
By defining the template in a separate file, your teams can edit and track template changes over time separate from code that uses the template.
Run Gosu statements and return no value using scriptlet syntax
You can define one or more Gosu statements as a statement list embedded in the template. Contrast this syntax with the template expression syntax, which requires Gosu expressions rather than Gosu statements. The results of scriptlet tags generate no output.
Define template parameters
Template files can define parameters that you pass to the template at run time.
Extend a template from a class to simplify static method calls
If you call static methods on one main class in your template, you can simplify your template code by using the extends feature.

See also