I have a message template that we use to print letters for those joining our association. We want to include the end date for their memberships in the letter (This used to be printed on membership cards, but we have ditched them.)
If I search for the new members and display the results as memberships, I can include the token {membership.end_date} in the letter but it displays as, say, 2016-12-27 which is not commonly seen in Australia.
Our site settings include define( 'CIVICRM_MAIL_SMARTY', 1 ); so the following code gives the formating I actually want:
<p>Your membership expires on:{capture assign=mem_end_date}{membership.end_date}{/capture} {$mem_end_date|date_format:"%d %B %Y"}</p>
Unfortunately this is somewhat temperamental. If I save the template when it is displaying the code and the next time I open it I select 'Source' before opening the template, then the formatting is correct.
However, if I save the template when it is displaying the code and then open the template before I select 'Source' the next time I use it, the " is changed to " (see below) and I don't get any end date printed at all.
<p>Your membership expires on:{capture assign=mem_end_date}{membership.end_date}{/capture} {$mem_end_date|date_format:"%d %B %Y"}</p>
Is there some other way I can write things so that it will retain the formatting I want without the person who will be running the letters having to remember to select source before opening the template?
This is a Drupal7/CiviCRMv4.4.16 site.