Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm trying to create a custom email to be sent when a user submits data to my form. I've placed the following in my themes template.php :
function phptemplate_webform_mail_message_18($form_values, $node, $sid, $cid) {
return _phptemplate_callback('webform-mail-18', array('form_values' => $form_values, 'node' => $node, 'sid' => $sid, 'cid' => $cid));
}
The node is called 18 (clean urls is NOT enabled)
The template file is called webform-mail-18.tpl.php and placed in the active theme directory (same directory as the template.php).
When the email is sent it comes through like:
This is the template I'm using (same as the suggested one in the readme)
<?php /* Begin sample webform mail message file */ ?>
Company X Official Website Submission
Message was submitted <?php echo format_date(time(), 'small') ?>
From the IP address <?php echo $_SERVER['REMOTE_ADDR']; ?>
The user's favorite color is <?php echo $form_values['submitted_tree']['favorite_color'] ?>
The user's problem is below:
<?php echo $form_values['submitted_tree']['problem'] ?>
<?php /* End sample webform mail message file */ ?>
Any help would be greatly appreciated.
Mike
Comments
Comment #1
mikebell_ CreditAttribution: mikebell_ commentedSorry it's not formatted properly:
When the email is sent it comes through like:
<!-- PHPTemplate was instructed to override the webform-mail-18 theme function, but no valid template file was found. -->
Comment #2
quicksketchHow strange, that message is displayed when PHPtemplate tries to open up a template file but can't find the file. So the code in template.php is working but it can't find the "webform-mail-18.tpl.php" file. I'm not sure what to suggest other than to check your file names for typos.
Comment #3
mikebell_ CreditAttribution: mikebell_ commentedCould it have anything to do with the extra space in the error? As in it's trying to look for *space*webmail-mail-18? I've added a space to the file name and tried it but no luck.
I looked throught the template.php code and couldn't find the extra space it was applying.
e.g. " webform-mail-18"
Comment #4
mikebell_ CreditAttribution: mikebell_ commentedI've found the problem, I uploaded the file to the active themes directory (zen/newfolder) but that happened to be a sub directory within the zen theme. Once I moved it into the zen theme folder it worked.
Comment #5
quicksketchAh, yes that wasn't fixed until Drupal 6 (in fact it still isn't fixed in 6.2, but it will be for 6.3). .tpl.php files must be in the base theme directory in D5, as far as I know.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
Quinti CreditAttribution: Quinti commentedExactly same problem here,
thankis
my question now is how put the variables of name and etc..., well, continuous investigating ji
Comment #8
nrasmus CreditAttribution: nrasmus commentedMostly just subscribing, but is there some way to alter the function in template.php to point it to the right path_to_subtheme, as is usually the case w/ Zen?
Comment #9
TrickerTreater CreditAttribution: TrickerTreater commentedI'm getting this error. I've moved the template & webform files all over and the email still says the template not found. I'm not using Zen.
Any help appreciated.