By default, BreezingForms comes with two text-based templates:
1. The mailtpl.txt.php file, which is used to send emails to the admin email address; and
2. The mailbacktpl.txt.php file, which is used to send emails to the mailback (user) email address.
You can also create templates in HTML format. If you want to use HTML for your emails, make a copy of the default file(s) noted above, and name it mailtpl.html.php for the admin email, or mailbacktpl.html.php for the mailback (user) email.
If an HTML layout is defined, it will be used in preference over the text-based template. There is not a way in the backend admin to choose which format you want to use, so if you decide not to use the HTML-based template, just delete it from the /mailtpl/ folder.
If you have created custom Email templates and then decide later to delete them, BreezingForms will revert back to the default layouts - so make sure you don't delete the original mailtpl.txt.php and mailbacktpl.txt.php files!
If you want your changes to apply to each and every form that you are using on your site, you can make changes directly to the two files noted above. (Make sure you store a copy on your hard drive as the files will be overwritten if you upgrade or reinstall the extension.)
If you only want to apply the changes to a specific form, then make a copy of the template and name it using the following naming conventions:
For admin email templates:
FORMNAME.txt.php
or
FORMNAME.html.php
For mailback email templates:
FORMNAME_mailback.txt.php
or
FORMNAME_mailback.html.php
* Replace FORMNAME with the name (not title) of your form, exactly as it appears in the NAME column of the "Manage Forms" screen. This is case-sensitive, so if your formname is ContactForm, then your template should be named ContactForm.txt.php for the admin email, or ContactForm_mailback.txt.php for the mailback email.
Changing Default Form Data
The code in the default template files looks like this:
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.'); ?> <?php if ($RECORD_ID != ''): ?> <?php echo $PROCESS_RECORDSAVEDID?> <?php echo $RECORD_ID ?><?php echo $NL ?> <?php endif; ?> <?php echo $PROCESS_FORMID?>: <?php echo $FORM ?><?php echo $NL ?> <?php echo $PROCESS_FORMTITLE ?>: <?php echo $TITLE ?><?php echo $NL ?> <?php echo $PROCESS_FORMNAME ?>: <?php echo $NAME ?><?php echo $NL ?> <?php echo $PROCESS_SUBMITTEDAT ?>: <?php echo $SUBMITTED ?><?php echo $NL ?> <?php echo $PROCESS_SUBMITTERIP ?>: <?php echo $IP ?><?php echo $NL ?> <?php echo $PROCESS_SUBMITTERID ?>: <?php echo $SUBMITTERID ?><?php echo $NL ?> <?php echo $PROCESS_SUBMITTERUSERNAME ?>: <?php echo $SUBMITTERUSERNAME ?><?php echo $NL ?> <?php echo $PROCESS_SUBMITTERFULLNAME ?>: <?php echo $SUBMITTERFULLNAME ?><?php echo $NL ?> <?php echo $PROCESS_PROVIDER ?>: <?php echo $PROVIDER ?><?php echo $NL ?> <?php echo $PROCESS_BROWSER ?>: <?php echo $BROWSER ?><?php echo $NL ?> <?php echo $PROCESS_OPSYS ?>: <?php echo $OPSYS ?><?php echo $NL ?> <?php foreach ($MAILDATA as $DATA): ?> <?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?> <?php endforeach; ?>
Understanding the Variables
RECORD_ID: Display the unique record number assigned to the submitted form.
PROCESS_FORMID: Displays the unique ID assigned to the form.
PROCESS_FORMTITLE: Displays the title of the form.
PROCESS_FORMNAME: Displays the name of the form.
PROCESS_SUBMITTEDAT: Date and time the form was submitted.
PROCESS_SUBMITTERIP: IP address of the user who submitted the form.
PROCESS_SUBMITTERID: If a registered user, will display the user's ID number.
PROCESS_SUBMITTERUSERNAME: If a registered user, will display the user's username.
PROCESS_SUBMITTERFULLNAME: If a registered user, will display the user's full name.
PROCESS_PROVIDER: If available, will display the user's provider.
PROCESS_BROWSER: Displays the submitter's browser information.
PROCESS_OPSYS: Displays the submitter's Operating System information.
FOREACH ($MAILDATA AS $DATA): Instructs the template to return the data for all logged fields.
$DATA[_FF_DATA_TITLE]: Displays the title (label) of each logged form element.
$DATA[_FF_DATA_VALUE]: Displays the value (user input) of each logged form element.
$DATA[_FF_DATA_NAME]: Displays the name (not title) of each logged form element.
ECHO $NL: In text-based templates, forces a new line.
You can delete most of the variables above if you don't want to include them in your template. The properties noted in red, however, are the ones which actually generate your element labels and values and should not be deleted (except in a case where you didn't want to show the label, for example).
You can also make changes to the layout of that code if you like. Using the code above, your label/value fields will be displayed as:
Title/Label: Value
Title/Label: Value
etc.
You might prefer to put the title on one line and the data value below it. To do that, change that snippet of code to:
Code:
<?php foreach ($MAILDATA as $DATA): ?> <?php echo $DATA[_FF_DATA_TITLE]?>:<?php echo $NL ?> <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?> <?php echo $NL ?> <?php endforeach; ?>
This will display the label/fields as follows:
Title/Label:
Value
Title/Label:
Value
etc.
Please see the attached file for a simple HTML layout that you can use as a starting point to build your own custom HTML-based template.