Answers.Body: <p>I think the real answer to this situation is: "don't use tpl.extra files in an extension". The reason is that there can be only one of them, and potentially many extensions. That little trick is really only suitable for in-house customizations, in which case you can stick it in the custom templates folder.</p>
  
  <p>Here's some solutions to the same problem that do scale:</p>
  
  <ul>
  <li>Use a <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference" rel="nofollow">hook</a> to inject your content into a <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Region+Reference" rel="nofollow">region</a>.</li>
  <li>If your tweak is simple, use <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pageRun" rel="nofollow">hook_civicrm_pageRun</a> to modify the page markup directly.</li>
  <li>If your tpl only contains javascript or css, put it in a css/js file and use <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Resource+Reference" rel="nofollow">CRM_Core_Resources</a> to add it via a <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference" rel="nofollow">hook</a>.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-27T14:47:45.577Z
Answers.Text: hook_civicrm_pageRun seems to only work on Pages, not Forms, per the docs?  I unfortunately need to add Smarty markup. I'd tried loading the template into a region, but since there's Smarty, I could only use `add("template")`, and that needs a filepath.  The docs don't explain how to construct the filepath, but the examples suggest the template has to be in the custom templates folder.  Am I missing something obvious?
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-27T15:57:01.730Z
Answers.Text: Probably now that you've solved your hook_civicrm_config problem adding a template to a region will work.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-27T14:31:53.393Z
Answers.LastActivityDate: 2015-03-27T14:31:53.393Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>When I'm working with custom code in CiviCRM particularly with extensions, I'll turn on <strong><em>System Settings -> Debugging</em></strong>. </p>
  
  <p>You can find it at the following URL: /civicrm/admin/setting/debug?reset=1</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-28T00:28:44.323Z
Answers.LastActivityDate: 2015-03-28T00:28:44.323Z
Answers.UserDisplayName: Andrew Wasson
Answers.Body: <p>This code might help shed some light:</p>
  
  <pre><code>  $template = CRM_Core_Smarty::singleton();
    print_r($template-&gt;template_dir);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-27T15:42:26.800Z
Answers.Text: Thank you!  This did the exact trick.  I'd accidentally screwed with the civix-generated hook_civicrm_config, so it wasn't adding my templates folder.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-27T10:41:59.723Z
Answers.LastActivityDate: 2015-03-27T10:41:59.723Z
Answers.UserDisplayName: davejenx
Body: <p>I was writing an extension which injects a template snippet, and was working fine.  While working on the PHP, without any change to the snippet, it's no longer loading (the rest of the extension IS working).  The template is at <code>&lt;extensionname&gt;/templates/Contact/Form/Contact.extra.tpl</code> (NOT in a "custom templates" folder - though if I move it there, it works).  I realize I have absolutely no idea how to check which file locations CiviCRM is checking for its template files, is there a way to see?</p>
  
Tags: <extension><debugging><templates>
Title: How to tell which .extra.tpl files CiviCRM is trying (and failing) to load?
ThreadText: # How to tell which .extra.tpl files CiviCRM is trying (and failing) to load?
  
  (Asked by: username_0 on 2015-03-27)
  
  I was writing an extension which injects a template snippet, and was working fine. While working on the PHP, without any change to the snippet, it's no longer loading (the rest of the extension IS working). The template is at `<extensionname>/templates/Contact/Form/Contact.extra.tpl` (NOT in a "custom templates" folder - though if I move it there, it works). I realize I have absolutely no idea how to check which file locations CiviCRM is checking for its template files, is there a way to see?
  
  **Tags:** extension, debugging, templates
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2015-03-27. Score: 5 | Accepted answer
  
  This code might help shed some light:
  
  ```
    $template = CRM_Core_Smarty::singleton();
    print_r($template->template_dir);
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you!  This did the exact trick.  I'd accidentally screwed with the civix-generated hook_civicrm_config, so it wasn't adding my templates folder.  
  
  ---
  
  ### Answer by username_1 on 2015-03-27. Score: 4
  
  I think the real answer to this situation is: "don't use tpl.extra files in an extension". The reason is that there can be only one of them, and potentially many extensions. That little trick is really only suitable for in-house customizations, in which case you can stick it in the custom templates folder.
  
  Here's some solutions to the same problem that do scale:
  
  * Use a [hook](http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference) to inject your content into a [region](http://wiki.civicrm.org/confluence/display/CRMDOC/Region+Reference).
  * If your tweak is simple, use [hook\_civicrm\_pageRun](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pageRun) to modify the page markup directly.
  * If your tpl only contains javascript or css, put it in a css/js file and use [CRM\_Core\_Resources](http://wiki.civicrm.org/confluence/display/CRMDOC/Resource+Reference) to add it via a [hook](http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference).
  
  > **Comments:**
  > **username_0**: hook_civicrm_pageRun seems to only work on Pages, not Forms, per the docs?  I unfortunately need to add Smarty markup. I'd tried loading the template into a region, but since there's Smarty, I could only use `add("template")`, and that needs a filepath.  The docs don't explain how to construct the filepath, but the examples suggest the template has to be in the custom templates folder.  Am I missing something obvious?  
  > **username_1**: Probably now that you've solved your hook_civicrm_config problem adding a template to a region will work.  
  
  ---
  
  ### Answer by username_2 on 2015-03-28. Score: 1
  
  When I'm working with custom code in CiviCRM particularly with extensions, I'll turn on ***System Settings -> Debugging***.
  
  You can find it at the following URL: /civicrm/admin/setting/debug?reset=1
  
  
  ---
  
  