Answers.Body: <p>one option might be to create a custom token {template.header} and {template.footer} that generates the needed html. the way you implement that function can be to fetch the html from a template. Note that it probably means you can't have token within these templates, that might or might not be an issue for you</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-04T15:35:13.310Z
Answers.LastActivityDate: 2015-05-04T15:35:13.310Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>I just want to clarify the basic functionality provided by CiviMail, since it may provide enough. CiviMail has separate functionality to manage headers and footers and templates. So a standard header and footer can be defined and used for several templates. At the time of configuring a mailing 1) the template if any is specified and then an instance (ie copy) of it can modified in the editor, and 2) the header if any and 3) the footer if any are also specified. If your main interest is in being able to separate managing the header and footer from all the templates that use them, this should be enough.</p>
  
  <p>If you are more interested in pre-assigning for each template a  specific header and footer, then a small extension could be developed that would allow the header and footer for a template to be specified when it is edited. Later when a mailing is being configured and a template is selected, those stored selections would be used to set the mailing's header and footer.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T10:27:30.070Z
Answers.Text: Thanks Joe. I'm particularly interested in the system-generated email message such as event confirmation emails, rather than the CiviMail templates.
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T00:57:47.413Z
Answers.LastActivityDate: 2015-04-10T19:45:53.473Z
Answers.LastEditDate: 2015-04-10T19:45:53.473Z
Answers.UserDisplayName: Joe Murray
Answers.Body: <p>We've done this, unless I'm misunderstanding you. </p>
  
  <p>I made an extension and put the required header code (in our case, a formatted address block) into a tpl in the templates/CRM/something directory. This included tokens etc. as it would have in the message template itself. Then in the message template I just used {include file=CRM/something/addressdate.tpl}. </p>
  
  <p>This works fine for us, but I did encounter weird stuff to do with needing/not-needing the $ symbol on tokens. This seemed directly related to the use of an include file, as the same issues didn't arise if you put the same header code into the message template itself. That said we have a bunch of other extensions, and I never figured out the root cause, so ymmv.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T13:12:30.013Z
Answers.Text: Forgot to say it probably needs CIVICRM_MAIL_SMARTY enabled in civicrm.settings.php.
Answers.UserDisplayName: Andrew West
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-12T18:33:06.663Z
Answers.Text: Sorry, I was a bit confusing there. There's nothing to the extension other than this template - I just like to keep things organised :-) You could put the .tpl file into your custom templates directory and it'd be exactly the same
Answers.UserDisplayName: Andrew West
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-18T18:32:59.860Z
Answers.Text: I see - sorry. Got a bit confused that this was re: CiviMail but OP is specific about System Workflow Messages.
Answers.UserDisplayName: Sonicthoughts
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T11:52:39.740Z
Answers.LastActivityDate: 2015-05-22T11:52:39.740Z
Answers.UserDisplayName: Andrew West
Answers.Body: <ol>
  <li><p>I dont think CiviCRM does this by default</p></li>
  <li><p>However, I do think this is a good idea and makes sense to include it in core for non-civimail mailings (which already have a header/footer)</p></li>
  <li><p>Might want to modify the core mailing functions: </p></li>
  </ol>
  
  <p>CRM_Core_BAO_MessageTemplate::sendTemplate</p>
  
  <p>to add a default header / footer</p>
  
  <ol start="4">
  <li>Might want to allow this to be overridden both at the system level, function level and via a hook</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T17:26:44.863Z
Answers.Text: Sounds great, but might require a significant amount of work. I'm also hoping there might be a quicker solution which would allow me to just {include} custom templates in the short term. But this would be something we would be happy to work on in the future if time allows us to.
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T22:27:51.353Z
Answers.Text: Its a relatively easy,small and localized patch. You can reuse most of the code from the civimal code file
Answers.UserDisplayName: Donald Lobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T16:05:08.427Z
Answers.LastActivityDate: 2015-04-09T16:05:08.427Z
Answers.UserDisplayName: Donald Lobo
Body: <p><strong>Details</strong></p>
  
  <p>We would like to create a standard header and footer for our email templates. Rather than pasting the custom HTML in the top of each system email template we want to override, it would be better to define a header template, and a footer template, and then use smarty to <a href="http://www.smarty.net/docsv2/en/language.function.include.tpl">{include}</a> these templates.</p>
  
  <p>Is this possible with CiviCRM?</p>
  
  <p>Is there a reason CiviCRM doesn't have a single header/footer template by default? If not would this make a reasonable feature request?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-28T17:46:26.653Z
Comments.Text: @John, not sure if you made any progress on this, but FYI on this forum post I just added: https://forum.civicrm.org/index.php?topic=37157.0
Comments.UserDisplayName: Laryn
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-18T18:31:31.977Z
Comments.Text: Please note that the question is regarding System Workflow Messages and not CiviMail Messages.
Comments.UserDisplayName: Sonicthoughts
Tags: <email><templates><custom-templates><smarty>
Title: How can I include a custom template file in an email template using smarty?
ThreadText: # How can I include a custom template file in an email template using smarty?
  
  (Asked by: username_0 on 2015-04-09)
  
  **Details**
  
  We would like to create a standard header and footer for our email templates. Rather than pasting the custom HTML in the top of each system email template we want to override, it would be better to define a header template, and a footer template, and then use smarty to [{include}](http://www.smarty.net/docsv2/en/language.function.include.tpl) these templates.
  
  Is this possible with CiviCRM?
  
  Is there a reason CiviCRM doesn't have a single header/footer template by default? If not would this make a reasonable feature request?
  
  **Tags:** email, templates, custom-templates, smarty
  
  > **Comments:**
  > **username_2**: Please note that the question is regarding System Workflow Messages and not CiviMail Messages.  
  > **username_1**: @username_0, not sure if you made any progress on this, but FYI on this forum post I just added: https://forum.civicrm.org/index.php?topic=37157.0  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_6 on 2015-04-09. Score: 6 | Accepted answer
  
  1. I dont think CiviCRM does this by default
  2. However, I do think this is a good idea and makes sense to include it in core for non-civimail mailings (which already have a header/footer)
  3. Might want to modify the core mailing functions:
  
  CRM\_Core\_BAO\_MessageTemplate::sendTemplate
  
  to add a default header / footer
  
  4. Might want to allow this to be overridden both at the system level, function level and via a hook
  
  > **Comments:**
  > **username_0**: Sounds great, but might require a significant amount of work. I'm also hoping there might be a quicker solution which would allow me to just {include} custom templates in the short term. But this would be something we would be happy to work on in the future if time allows us to.  
  > **username_6**: Its a relatively easy,small and localized patch. You can reuse most of the code from the civimal code file  
  
  ---
  
  ### Answer by username_3 on 2015-05-04. Score: 1
  
  one option might be to create a custom token {template.header} and {template.footer} that generates the needed html. the way you implement that function can be to fetch the html from a template. Note that it probably means you can't have token within these templates, that might or might not be an issue for you
  
  
  ---
  
  ### Answer by username_4 on 2015-04-10. Score: 1
  
  I just want to clarify the basic functionality provided by CiviMail, since it may provide enough. CiviMail has separate functionality to manage headers and footers and templates. So a standard header and footer can be defined and used for several templates. At the time of configuring a mailing 1) the template if any is specified and then an instance (ie copy) of it can modified in the editor, and 2) the header if any and 3) the footer if any are also specified. If your main interest is in being able to separate managing the header and footer from all the templates that use them, this should be enough.
  
  If you are more interested in pre-assigning for each template a specific header and footer, then a small extension could be developed that would allow the header and footer for a template to be specified when it is edited. Later when a mailing is being configured and a template is selected, those stored selections would be used to set the mailing's header and footer.
  
  > **Comments:**
  > **username_0**: Thanks Joe. I'm particularly interested in the system-generated email message such as event confirmation emails, rather than the CiviMail templates.  
  
  ---
  
  ### Answer by username_5 on 2015-05-22. Score: 1
  
  We've done this, unless I'm misunderstanding you.
  
  I made an extension and put the required header code (in our case, a formatted address block) into a tpl in the templates/CRM/something directory. This included tokens etc. as it would have in the message template itself. Then in the message template I just used {include file=CRM/something/addressdate.tpl}.
  
  This works fine for us, but I did encounter weird stuff to do with needing/not-needing the $ symbol on tokens. This seemed directly related to the use of an include file, as the same issues didn't arise if you put the same header code into the message template itself. That said we have a bunch of other extensions, and I never figured out the root cause, so ymmv.
  
  > **Comments:**
  > **username_5**: Forgot to say it probably needs CIVICRM_MAIL_SMARTY enabled in civicrm.settings.php.  
  > **username_5**: Sorry, I was a bit confusing there. There's nothing to the extension other than this template - I just like to keep things organised :-) You could put the .tpl file into your custom templates directory and it'd be exactly the same  
  > **username_2**: I see - sorry. Got a bit confused that this was re: CiviMail but OP is specific about System Workflow Messages.  
  
  ---
  
  