Hi there,
I have a form that has 7 file upload fields. Each of the fields is optional. I have created the email template so that the file link is created. When there is no file uploaded, the email template displays the code for the plugin:
{_PLUGINS_.upload_files.input_file_1.name}
in place of the missing file name. How can I prevent the display of this code of there is no file uploaded through this optional field?
I have a form that has 7 file upload fields. Each of the fields is optional. I have created the email template so that the file link is created. When there is no file uploaded, the email template displays the code for the plugin:
{_PLUGINS_.upload_files.input_file_1.name}
in place of the missing file name. How can I prevent the display of this code of there is no file uploaded through this optional field?
Is there any way to add an if statement somewhere to determine if the
{_PLUGINS_.upload_files.input_file_1.name}
item is NULL or blank, and to not include it in the template if it is?
{_PLUGINS_.upload_files.input_file_1.name}
item is NULL or blank, and to not include it in the template if it is?
Hi fourmat,
I think that in this case I'd build the links block for the template in a Custom Code action before the Email action and include it into the Email template. Something like this:
Bob
I think that in this case I'd build the links block for the template in a Custom Code action before the Email action and include it into the Email template. Something like this:
<?php
$links = array;
if ( !isset($form->data['_PLUGINS_']['upload_files']) || !is_array($form->data['_PLUGINS_']['upload_files']) ) {
return false;
}
$files =& $form->data['_PLUGINS_']['upload_files'];
for ( $i = 1; $i <= 7; $i++ ) {
$input = 'input_file_'.$i;
if ( isset($files[$input]['name']) && $files[$input]['name'] ) {
$links[] = "<a href='{$files[$input]['name']}' >{$files[$input]['name']}</a>";
}
}
$form->data['links'] = implode('<br />', $links);
?>
Then add {links} into the email template.Bob
This topic is locked and no more replies can be posted.