Hi again,

I've started using the Webform module and I need to change the output e-mail format so I did as described in the THEMING.txt and added the following to my template.php:

[code]
function phptemplate_webform_create_mailmessage_44 ($formData, $node) {
return _smarty_callback('webform_create_mailmessage_44', array('formData' => $formData, 'node' => $node));
}
[/code]

And created a file named webform_create_mailmessage_44.tpl in my theme directory.

However, the template file is not picked up. When I rename the function to "smarty_webform_create_mailmessage_44" I get a "undefined function _smarty_callback()" php error.

I also tried to add this to the smarty_register_functions :
'webform_create_mailmessage_44' => 'phptemplate_webform_create_mailmessage_44');
but with no result.

I'm quite new to this and lost the clue to where to look next, any help would be greatly appreciated.

Thanks in advance, Nda

Comments

tdimg’s picture

Try to call your function one of the following:

smarty_webform_create_mailmessage_44
_smarty_webform_create_mailmessage_44

Also, check out the handbook pages about smarty theming: http://drupal.org/node/27536

If that doesn't work, could you post the theming.txt as I do not have the webform module.

Nda’s picture

Thanks! It seems you've sent me in the right direction. What I ended up with is:

function smarty_webform_create_mailmessage_44 ($formData, $node)
{
return _phptemplate_callback('webform_create_mailmessage_44', array('formData' => $formData, 'node' => $node));
}

Strangely this works and uses the .tpl file. Next thing I'm stuck on is that the html code in my .tpl file is displayed as full text in the output mail. :(

tdimg’s picture

the _phptemplate_callback shouldn't work either, it should be _smarty_callback - don't mix phptemplate and smarty, these are two different engines, though smarty for drupal 5 is built on phptemplate and thus your callback could work but still you shouldn't use it like that.

As I said, read through the handbook pages on smarty.

Nda’s picture

That's what I thought ye but if I use _smarty_callback I get a "call to undefined function" error :(