Hi,
I want to have a text file that contains a serial number for submitted email. I want to have this serial number show up in the subject line for the emails to the client and user, but I also want to be able to add the serial number in the text of the email message to the user.
I have been able to get the serial number and add it to the subject lines, but I can't get it to use in the message text.
I added a hidden field called count inot the form.
In the On Submit event I added a Custom code block. This is where I get the count from the file. What I tried to do is update the count field, so it could be used in the email message text. Like so:
I gather that the email text already has had the variables replaced by the time this code gets executed which is why the {count} doesn't show up with either a number form the count.txt file or TEST. So, where can I put the code to get the count.txt data, update it before the variables get replaced in the email text?
The email text has:
Worksheet #: {count}
in it.
Thank you for your help
I want to have a text file that contains a serial number for submitted email. I want to have this serial number show up in the subject line for the emails to the client and user, but I also want to be able to add the serial number in the text of the email message to the user.
I have been able to get the serial number and add it to the subject lines, but I can't get it to use in the message text.
I added a hidden field called count inot the form.
In the On Submit event I added a Custom code block. This is where I get the count from the file. What I tried to do is update the count field, so it could be used in the email message text. Like so:
<?php
// Change the Subjects to have the site name in them
$name = JRequest::getString('first_name', '', 'post') . ' ' . JRequest::getString('last_name', '', 'post');
// Get the hidden field that the counter goes into
$count = JRequest::getString('count', '', 'post');
// Check for an RLAB email address
$email = JRequest::getString('email', '', 'post');
if (strpos($email, '@doamin.com') === false) {
$form->data['toemail'] = 'joomla@domain.com';
$form->data['bccemail'] = 'bcc@domain.ca';
// Add code to read count file & update it
$count = JFile::read('/home/sccsnew/public_html/_private/count.txt');
$count++;
JFile::write('/home/sccsnew/public_html/_private/count.txt', $count);
} else {
// Found a RLAB email address, so change the To email address
$form->data['toemail'] = $email;
$form->data['bccemail'] = '';
$count = 'TEST';
}
$subject = "Quick Form: $count on domain.ca from: $name";
$form->data['subject2'] = $subject;
$form->data['subject3'] = "Quick Form: $count submission on domain.ca";
JRequest::setVar('count', $count); // Update the hidden count variable for use in the email text
?>
I gather that the email text already has had the variables replaced by the time this code gets executed which is why the {count} doesn't show up with either a number form the count.txt file or TEST. So, where can I put the code to get the count.txt data, update it before the variables get replaced in the email text?
The email text has:
Worksheet #: {count}
in it.
Thank you for your help