...
The xhtml theme provides several good examples of the "wrapping" technique. The simple theme renders the basic control. The xhtml theme "dresses up" many of the controls by adding a header and footer.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" /> <#include "/${parameters.templateDir}/simple/xxx.ftl" /> <#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /> |
...
UIBean provides few special parameters which can be used to build a new template (they are already used in xhtml
and css_xhtml
theme):
templateDir
- current value of templateDir parameter, see Selecting Template Directorytheme
- used theme, see Selecting Themestemplate
- name of the template file to use (i.e. text)themeExpansionToken
- special token used to indicate to search for a template also in parent theme (when used with<#include />
directive)expandTheme
- tells internal template loader mechanism to try load template from current theme and then from parent theme (and parent theme, and so on)
Using expandTheme
parameter allows to override only some parts of the theme's templates, e.g. css.ftl. You can define a new theme (set theme.properties) and override just single file.
...