About Telegraph Config (.xml) Files
Telegraph uses a separate XML-style configuration file to control form actions. To add a new action to a form (e.g., emailing form input), simply add a line of code for the corresponding Telegraph directive.
Naming and Creation
- Navigate to your form’s parent directory.
- Create a subdirectory named telegraph.
- Navigate to the subdirectory telegraph.
- Create a file named config.xml. (Note: you can rename this file according your needs; however, make sure that its name matches that contained in the form_configuration tag on your form:
<input type="hidden" name="form_configuration" value="telegraph/config.xml" />
The standard Telegraph directives follow a basic XML tag format:
<directive action="_____" />
Make sure that your tag opens correctly and self-closes properly, in a valid markup format. Each directive should be placed on its own line; no other code needs to be added. Telegraph will ignore any information not contained within the configuration file’s XML tags.
One of the simplest directives, Imperius, requires only a single parameter, the action:
<directive action="imperius" />
A particular directive may require additional parameters, or allow them to be added for additional functions. The email directive, for example, requires the to parameter, indicating where the email is to be sent.
<directive action="email" to="firstname.lastname@example.org" />
You can also add additional parameters within a directive:
<directive action="email" to="email@example.com" from="[email] subject="Granite Orders" template="orders.template" />
Special directives use the basic format:
<directive special="_____" />
Aside from substituting special for action, they use the same format as the standard Telegraph directives.