Smarty issues in Templates
I had mentioned the issue I came across in chat, but I believe the issue is more to do with using Smarty in MessageTemplates and sending them through CiviRule Actions, or when certain Smarty is used in System Messages.
The main issue I have run across is if you try to use the {literal}
Smarty tag in your template. Originally I was having issues when I was using the MosaicoMsgTmpl for emails. The message templates generated were commenting out the CSS, but this issue is for anytime you use {literal}
in your message template. The onRender for the SmartyTokenSubscriber is where the issue comes in.
When the onRender
is called the $e->string
has already been parsed by Smarty and in the case of the template, the {literal}
has already been removed. Then when you call the $smarty->fetch
method, it is failing since the content is no longer marked with the literal tag. So the issue is more in that Smarty has already parsed the email message by the time the onRender
is hit so it has already parsed the content and is ready to be used in the email.
I believe the SmartyTokenSubscriber
is meant mainly for messages sent out through Civi directly or when doing a mass mailing. But when email is sent from System messages or CiviRules, the error is happening. Not sure if there is a way to do a check in the onRender
function for those instances in which it needs to parse the Smarty logic, otherwise it would just pass what it has along.