How to use a master template
Master templates can be used to define a structure for your form fields or email templates. You can add the fields to your template by simply using a marker.
Example:
Master template:
<!-- ###field_input### --> ###error_###fieldname###### <label for="###fieldname###">###LLL:###fieldname######</label> <input type="text" name="###fieldname###" id="###fieldname###" value="###value_###fieldname######" /> <!-- ###field_input### --> <!-- ###field_submit### --> ###LLL:label_submit### <input type="submit" ###submit_nextStep### value="Abschicken" /> <!-- ###field_submit### -->
As you can see, there are two subparts containing the structure for an input field and the submit button.
Each subpart must begin with either “field_” or “master_” the rest can be defined to your liking.
In your HTML template you can simply add a marker referring to this subpart and enter a fieldname as suffix:
<!-- ###TEMPLATE_FORM1### --> <form action="###rel_url###"> <input type="hidden" name="formhandler[submitted]" value="1"/> <input type="hidden" name="id" value="###pid###" /> ###field_input_name### ###field_submit### </form> <!-- ###TEMPLATE_FORM1### -->
The marker ###field_input_name### refers to the subpart ###field_input###. The additional “_name” is the value to replace the ###fieldname### markers with.
If you don't add this suffix, the marker ###fieldname### will not be replaced (as in ###field_submit###).
The final HTML will look like this:
<!-- ###TEMPLATE_FORM1### --> <form action="###rel_url###"> <input type="hidden" name="formhandler[submitted]" value="1"/> <input type="hidden" name="id" value="###pid###" /> ###error_name### <label for="name">###LLL:name###</label> <input type="text" name="name" id="name" value="###value_name###" /> ###LLL:label_submit### <input type="submit" ###submit_nextStep### value="Abschicken" /> </form> <!-- ###TEMPLATE_FORM1### -->
Using the master template you can predefine HTML for your fields and manage it in a single file. You can import the subpart into your HTML template as many times as you want.
NOTE: If you use multiple master templates subparts with the same name will be overriden by the last master template containing the subpart!
Passing parameters to the subpart
Since version 1.5 it is possible to pass custom parameters to the subpart.
Usage: ###field_[key]_[fieldname];foo,bar###
In the master template you can use the markers ###param1###, ###param2### and so on. ###param1### will be replaced with "foo", ###param2### will be replaced with "bar".