NAME
HTML::FormEngine::Skin - FormEngines default skin
THE TEMPLATE SYSTEM
Variables
Variables must have the following format:
<&[A-Z_]+&>
When the template is processed these directives are replaced by the variables value. If no value was defined, the default value is used, if even this is missing, they're just removed.
Handler calls
You can call a handler out of an template and so replace the call directive with the handlers return value. Handler calls must have the following format:
<&[a-z_]+( ((?!<&|&>)..)*.?)?&>
The first part is the name of the handler or the template, the second part is optional, it can be used to pass arguments to the handler. So <&error ERROR_IN&
> calls the error handler and passes to it ERROR_IN as argument. Mostly handlers are called with out any arguments, e.g. <&value&
>, which calls the value handler.
The handlers are defined in Handler.pm and registered in Config.pm. The default handler is used for processing templates. So if you want to nest templates, you might use the templates name as a handler name and so call the default handler which will return the processed template code.
For more information about handlers, see the pod documentation of Handler.pm.
Loops
If you want to repeat a certain template fragment several times, you can use the following notation:
<~some lines of code~LOOPVARIABLES SEPERATED BY SPACE~>
If one or more loop variables are array references, the loop is repeated until the last loop variable as no element left. If all loop variables are scalars, the code is only printed once. If one ore more, but not all loop variables are scalars, these scalar variables have in every repition the same value. If a loop variable is an array reference, but has no elements left, it has the NULL value in the following repitions.
You can nest loops. For example the text template uses this feature: If you use one dimensional arrays, the text fields are printed each on a single line, if you use two dimensional arrays, you can print several text fields on the same line.
<! !> Blocks
Code that is enclosed in '<! ... ! VARIABLENAMES !>' is only printed when all variables which are mentioned in VARIABLENAMES are defined (not empty). If you seperate the variable names by '|' instead of ' ', only one of these variables must be defined.