Writing as a self-answered question since it may help others...

I am adding smarty code to a mail template. Including:

{capture assign=designation}{contribution.contribution_source}{/capture}

Later in the page, I call the variable as such:

{if $designation}, for {contribution.contribution_source}{/if}

But the template breaks when I try to use it. The code looks good as far as I can tell. What's the problem?

up vote 3 down vote accepted

The problem is that the space in the if-statement is   rather than a normal space. For this reason, it's worth writing your smarty statements while viewing the Source code in the template editor.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.