Answers.Body: <p>Hardcoding cusomised templates into extensions is in breach of extension development standards and can break on upgrades. Prevention of errors is an important priority to most developers to take pride in their craft and care about their clients.</p>
  
  <p>The answer in your extension is to include the modified file in the path form template/CRM/path/to/template.tpl.php - but please find a better way. Civi users deserve great products that they get from other services, not this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-24T19:06:38.083Z
Answers.Text: I appreciate their work. But I want to customize dashboard means I want to show all the contacts.
Answers.UserDisplayName: deepak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-24T19:43:46.410Z
Answers.Text: Then don't just hijack a random field (like is_auto) if they need a custom field like you tried to last time. "I don't think it's used for anything you need it for".
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-25T07:02:42.993Z
Answers.Text: Will you provide some code snippets to overwrite template?
Answers.UserDisplayName: deepak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-26T14:58:22.970Z
Answers.Text: Don't hijack fields Deepak! Do things properly and give your clients a quality service.
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-23T00:25:27.193Z
Answers.LastActivityDate: 2019-02-23T05:09:08.623Z
Answers.LastEditDate: 2019-02-23T05:09:08.623Z
Answers.UserDisplayName: JohnFF
Answers.Body: <p>You can use <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterTemplateFile/" rel="nofollow noreferrer">hook_civicrm_alterTemplateFile</a> to select a different template file - but beware of the problems of overriding templates. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-26T09:42:25.780Z
Answers.LastActivityDate: 2019-02-26T09:42:25.780Z
Answers.UserDisplayName: Aidan
Body: <p>I want to override predefined template file in my extension.How to do that using php?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-22T16:11:00.310Z
Comments.Text: Can you give more info. Is this a CiviCRM template or your CMS template? And which template are you wanting to override?
Comments.UserDisplayName: Iowa Boy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-22T16:17:20.417Z
Comments.Text: I want to load my custom template override on dashboard template
Comments.UserDisplayName: deepak
Tags: <extension>
Title: How to overwrite template file using php?
ThreadText: # How to overwrite template file using php?
  
  (Asked by: username_0 on 2019-02-22)
  
  I want to override predefined template file in my extension.How to do that using php?
  
  **Tags:** extension
  
  > **Comments:**
  > **username_1**: Can you give more info. Is this a CiviCRM template or your CMS template? And which template are you wanting to override?  
  > **username_0**: I want to load my custom template override on dashboard template  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-02-23. Score: 1
  
  Hardcoding cusomised templates into extensions is in breach of extension development standards and can break on upgrades. Prevention of errors is an important priority to most developers to take pride in their craft and care about their clients.
  
  The answer in your extension is to include the modified file in the path form template/CRM/path/to/template.tpl.php - but please find a better way. Civi users deserve great products that they get from other services, not this.
  
  > **Comments:**
  > **username_0**: I appreciate their work. But I want to customize dashboard means I want to show all the contacts.  
  > **username_2**: Then don't just hijack a random field (like is_auto) if they need a custom field like you tried to last time. "I don't think it's used for anything you need it for".  
  > **username_0**: Will you provide some code snippets to overwrite template?  
  > **username_2**: Don't hijack fields Deepak! Do things properly and give your clients a quality service.  
  
  ---
  
  ### Answer by username_3 on 2019-02-26. Score: 0
  
  You can use [hook\_civicrm\_alterTemplateFile](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterTemplateFile/) to select a different template file - but beware of the problems of overriding templates.
  
  
  ---
  
  