I'm not sure where to look - I've tried everything that I can think of to get smarty to work in an email template, but it's just not happening.
I'm using CiviCRM 4.7.27 with WordPress 4.9.3.
I've changed the smarty setting in /public_html/wp-content/uploads/civicrm/civicrm.settings.php:
if (!defined('CIVICRM_MAIL_SMARTY')) { define( 'CIVICRM_MAIL_SMARTY', 1 ); }
But I can't get a smarty statement to work in a mailing.
If I use a Mosaico template, I get the source code in the email eg {capture assign=newsletter}Yes{/capture} {if $newsletter == Yes} You agreed to receive our emails. {/if}
If I use a new mailing (traditional) using the Sample CiviMail Newsletter template and try to test the mailing, I get an error message: " Sorry an error occurred and your information was not saved"
Tokens work fine.
Any idea re what the problem is?
UPDATE:
Have gotten Traditional mail to output the Smarty code properly. It was all due to some syntax issues. It's hard to test under an administrator account which may not have the same contents as a regular account. The remaining problem is that Mosaico templates don't work. Here's a sample of what comes through:
{capture assign=contactId}18{/capture} {crmAPI var='result' entity='Membership' action='getcount' sequential=0 contact_id=$contactId membership_type_id="Family" active_only=1} {if $result gt 0} Dear Test and family, {else} Dear Test, {/if}
Thank you for purchasing a 2018 membership!
{capture assign=newsletter}Yes{/capture} {if $newsletter}Because you've indicated you'd like to receive our e-news, you’ll get our newsletter about once a month with info on cycling events and issues, volunteer opportunities, and cycling events and meetings.{/if} {capture assign=interests}5{/capture}
{if $interests}You've also indicated that you're interested in participating in some of our activities. We'll send you information when there's one of your chosen activities planned.{/if}
{capture assign=volunteer}5{/capture} {if $volunteer}Since you also indicated you're interested in voluneering for some of our activities, one of our activity team leaders will contact you when there's an opportunity to volunteer to help out.{/if}
If anyone has any ideas, that would be great.