Answers.Body: <p>As a workaround for the specific example in your post, you can create a custom token.  <a href="https://civicrm.org/blog/colemanw/create-your-own-tokens-for-fun-and-profit" rel="nofollow noreferrer">This post</a> explains how using <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokens/" rel="nofollow noreferrer">hook_civicrm_tokens</a> and <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokenValues/" rel="nofollow noreferrer">hook_civicrm_tokenValues</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-25T09:30:14.723Z
Answers.Text: Thanks. That’s how we have achieved our goal.
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-25T09:23:20.130Z
Answers.LastActivityDate: 2019-07-25T09:23:20.130Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>I looked into it a while back. Seems mosaico is not compatible with smarty. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-24T16:29:54.690Z
Answers.Text: Thanks, is there a workaround?
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-24T16:59:39.373Z
Answers.Text: Not afaik. Would live to hear of one if you do find.
Answers.UserDisplayName: netzih
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-24T16:29:24.623Z
Answers.LastActivityDate: 2019-07-24T16:29:24.623Z
Answers.UserDisplayName: netzih
Body: <p>I used to use a name personalisation in civimail with smarty script...</p>
  
  <pre><code>{capture assign=nickname}{contact.nick_name}{/capture} Dear {if $nickname}{contact.nick_name}{else}{contact.sort_name}{/if}
  </code></pre>
  
  <p>I was testing if this script would render in mosaico 2.x, it seems doesn't work. Is there any workaround? Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-24T16:57:49.530Z
Comments.Text: Have you turned on SMARTY in civicrm.settings.php?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-24T17:00:16.313Z
Comments.Text: Smarty can be turned on. It won't help with mosaico.
Comments.UserDisplayName: netzih
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-24T17:00:38.167Z
Comments.Text: yes, its turned on , and I was using with civimail
Comments.UserDisplayName: Tapash
Tags: <mosaico><smarty>
Title: How to include smarty script with mosaico email
ThreadText: # How to include smarty script with mosaico email
  
  (Asked by: username_0 on 2019-07-24)
  
  I used to use a name personalisation in civimail with smarty script...
  {capture assign=nickname}{contact.nick_name}{/capture} Dear {if $nickname}{contact.nick_name}{else}{contact.sort_name}{/if}
  
  I was testing if this script would render in mosaico 2.x, it seems doesn't work. Is there any workaround? Thanks
  
  **Tags:** mosaico, smarty
  
  > **Comments:**
  > **username_1**: Have you turned on SMARTY in civicrm.settings.php?  
  > **username_2**: Smarty can be turned on. It won't help with mosaico.  
  > **username_0**: yes, its turned on , and I was using with civimail  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2019-07-25. Score: 3 | Accepted answer
  
  As a workaround for the specific example in your post, you can create a custom token. [This post](https://civicrm.org/blog/colemanw/create-your-own-tokens-for-fun-and-profit) explains how using [hook\_civicrm\_tokens](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokens/) and [hook\_civicrm\_tokenValues](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_tokenValues/)
  
  > **Comments:**
  > **username_0**: Thanks. That’s how we have achieved our goal.  
  
  ---
  
  ### Answer by username_2 on 2019-07-24. Score: 2
  
  I looked into it a while back. Seems mosaico is not compatible with smarty.
  
  > **Comments:**
  > **username_0**: Thanks, is there a workaround?  
  > **username_2**: Not afaik. Would live to hear of one if you do find.  
  
  ---
  
  