Smarty errors when sending a message template
Created by: artfulrobot
The API MessageTemplate.Send
method always uses Smarty. Doesn't care about CIVICRM_MAIL_SMARTY
being defined at all.
Presumably this is because the system uses this to send a lot of message templates that massively depend on Smarty.
But it means smarty errors flood your logs, because the CSS etc is not wrapped in {literal}
tags.
One solution is to
define( 'CIVICRM_MAIL_SMARTY', 1);
and then re-sync (as @michaelmcandrew points out) the templates.
However, that has the side effect of using smarty for all CiviMail's bulk mail. This will, I believe, slow CiviMail down quite a bit.
I think we need to find a way to say "This message template needs smarty-proofing".
Alternatively, would it work to do this instead?:
$html = str_ireplace(array('<head>', '</head>'),
array('<!--{literal}--><head>', '</head><!--{/literal}-->'), $html);
Presumably that would mean we could do the same thing to smarty and non smarty because even though the literals are left in, they're in html comments?