Answers.Body: <p>You can code an extension to provide custom tokens using <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_tokens" rel="nofollow">hook_civicrm_tokens</a> and <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_tokenValues" rel="nofollow">hook_civicrm_tokenValues</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-28T08:21:18.687Z
Answers.LastActivityDate: 2015-09-28T08:21:18.687Z
Answers.UserDisplayName: DaveFF
Answers.Body: <p>I have had success in differentiating content based on the value of a custom field by enabling Smarty for message templates <a href="http://wiki.civicrm.org/confluence/display/CRMDOC46/Smarty+in+mail+templates" rel="nofollow">http://wiki.civicrm.org/confluence/display/CRMDOC46/Smarty+in+mail+templates</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T23:49:19.877Z
Answers.LastActivityDate: 2015-09-27T11:51:26.497Z
Answers.LastEditDate: 2015-09-27T11:51:26.497Z
Answers.UserDisplayName: JoAnne
Body: <p>I have created a template that I am going to send to a group of people. Depending on a certain value (in this case a custom field), I want to use a different picture.</p>
  
  <p>Today I create four different templates.</p>
  
  <p>Is there a way to "merge" content in a template based on another field value?</p>
  
  <p>And is it a generic way of doing this, if I next time want to merge different sentences, based on the same field values I used for the pictures?</p>
  
  <p>(I have looked at the extension <a href="https://civicrm.org/extensions/content-tokens" rel="nofollow">Content Tokens</a>, but this is slightly different)</p>
  
Tags: <tokens>
Title: Token for different content?
ThreadText: # Token for different content?
  
  (Asked by: username_0 on 2015-09-26)
  
  I have created a template that I am going to send to a group of people. Depending on a certain value (in this case a custom field), I want to use a different picture.
  
  Today I create four different templates.
  
  Is there a way to "merge" content in a template based on another field value?
  
  And is it a generic way of doing this, if I next time want to merge different sentences, based on the same field values I used for the pictures?
  
  (I have looked at the extension [Content Tokens](https://civicrm.org/extensions/content-tokens), but this is slightly different)
  
  **Tags:** tokens
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-09-26. Score: 3 | Accepted answer
  
  I have had success in differentiating content based on the value of a custom field by enabling Smarty for message templates <http://wiki.civicrm.org/confluence/display/CRMDOC46/Smarty+in+mail+templates>
  
  
  ---
  
  ### Answer by username_1 on 2015-09-28. Score: 0
  
  You can code an extension to provide custom tokens using [hook\_civicrm\_tokens](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_tokens) and [hook\_civicrm\_tokenValues](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_tokenValues).
  
  
  ---
  
  