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

mikebell_’s picture

Sorry 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. -->

quicksketch’s picture

How 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.

mikebell_’s picture

Could 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"

mikebell_’s picture

I'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.

quicksketch’s picture

Status: Active » Fixed

Ah, 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.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Quinti’s picture

Exactly same problem here,

thankis

my question now is how put the variables of name and etc..., well, continuous investigating ji

nrasmus’s picture

Mostly 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?

TrickerTreater’s picture

I'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.