HTML::FormEngine::Skin - FormEngines basic skin package
The parsing of the templates is done from left to right and from top to bottom!
Variables must have the following format:
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.
Variables, defined for a certain template, are valid for all subtemplates too!
You can call a handler out of a template and so replace the call directive with the handlers return value.
A handler name must match the follwing regular expression: #?[a-z_]+[a-z_0-9]+.
Optionally one can pass arguments to a handler.
<&error ERROR_IN&> calls the error handler and passes to it ERROR_IN as argument.
Mostly handlers are called without any arguments,
which calls the value handler.
Handler calls can also be nested,
<&<&arg 1&> ERROR_IN&>.
In that example first
<&arg 1&> is called,
the result is expected to be the name of a handler which is then called with ERROR_IN as argument.
The handlers are normally defined in Handler.pm, but you can also define them directly in the skin or wherever you think it fits best. Important is that they're registered correctly by the skin. Read HTML::FormEngine::Skin, HTML::FormEngine::SkinComplex and HTML::FormEngine::SkinClassic for more information.
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.
To distinguish handler calls from template calls a # is added infront of the name if a existing handler and not the default handler is to be called. This is only a convention and not necessary from the technical point of view.
For more information about handlers, see the HTML::FormEngine::Handler.
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 repetition the same value. If a loop variable is an array reference, but has no elements left, it has the NULL value in the following repetitions.
You can nest loops. For example the ClassicSkin 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.
Since FormEngine 1.0 you can also define loops without specifying loop variables. These loops are called global loops and they iterate over all used variables. That means as long as one of the variables used in the loops content has another element the loop is repeated. For example the row template of the ComplexSkin uses this feature.
Code that is enclosed in '<! ... ! VARIABLENAMES !>', is only printed when all variables which are mentioned in VARIABLENAMES are defined (that means not empty). If you seperate the variable names by '|' instead of ' ', only one of these variables must be defined.
This class is abstract and not a complete skin class but its the basis of all skins. That means all methods defined here are available in all skins. In case you write your own skin you should also base it on this class if it makes sense. if not you should at least support the same methods.
This method is the constructor.
It returns the skin object.
Optionally you can pass it the path to your locale directory.
By default this is
It is needed for
gettext which translates the error messages and other stuff.
Use this method to set the textdomain.
Returns the definition of the template with the given name.
If no name is given a hash reference containing all templates is returned.
Overwrites all template definitions. Not recommended.
If you only want to add or overwrite some templates, call this method. You have to pass a reference to the hash which stores these templates.
If no arguments specified it just returns all default settings in a hash reference.
If $templ is given it returns the default settings for template $templ.
If $var is also given it returns the default setting of the variable $var in template $templ.
By using this method, you completly reset the default values of the template variables. You have to pass a reference to the hash which stores the new settings. In most cases you better call "alter_default ( HASHREF )".
Pass a hash reference to this method for adding or overwriting default values.
If $name is given it returns a reference to the handler having the given name.
If not it returns a hash reference containing all handlers.
This method resets the handler settings. If you just want to add or overwrite a handler setting, use "alter_handler ( HASHREF )".
This method adds or overwrites template handlers. Have a look at Handler.pm for more information.
If $name is given it returns a reference to the check function registered by the skin as $name.
If $name is not given it returns a hash reference containing all check functions.
This method resets the check settings. If you just want to add or overwrite a check function, use "alter_check ( HASHREF )".
This method adds or overwrites check routines. Have a look at Checks.pm for more information.
Returns 1 (true) if the template with the given name is registered as hidden. Also see "set_hidden ( ARRAY )"
Returns an array containing the names of all templates which are registered as hidden. Also see "set_hidden ( ARRAY )".
With this method you can reset the list of templates which are handled as hidden-templates, that means which shouldn't use any visible space and for which it doesn't matter where they're placed in the form. By default this list only contains hidden as reference to the template called hidden.
Returns the skin object which is used instead of this skin when the confirm form is created.
confirm ([ CONFIRMSG ]) for more information.
Sets the confirm skin to the given skin object.
confirm ([ CONFIRMSG ]) for more information.
Returns the string which is returned by the not_null handler in case a certain field must be filled out. By default that's the empty string (no mark). A good value is e.g. *. Use "set_not_null_string ( $string )" to modify it.
And read the source code, especially the template definitions.