<p>Setting template mode to CP with <code>craft()-&gt;templates-&gt;setTemplateMode(TemplateMode::CP)</code> only lets me load templates from <code>app/templates</code>.</p>

<p>If i load <code>app/templates/entries/_fields.html</code> and I use custom fields in the entry, this will attempt to load those edit templates from <code>plugins/{pluginName}/templates</code> and I receive an error because the templates could not be found in <code>app/templates</code>.</p>

<p>Shouldn't templateMode -> CP behave more like proper CP and not just set a single load path?</p>

CC BY-SA 3.0
2016-08-31T18:42:15.520Z
I'm not sure I'm following what you're after 100%, maybe you're looking to call `craft()->templates->setTemplatesPath()` directly and give it your plugin's template path?
Brad Bell
CC BY-SA 3.0
2016-09-01T06:44:39.427Z
@BradBell I know I can do that, but I can't include a plugin template that includes a CP-template, or a CP-template that includes a plugin-template. Say that I include `app/templates/entries/_fields.html` and the entry has a Neo-matrix, or Supertable or something like that, then I get template errors because the CP-template is trying to include templates that only exists in the respective plugin(s)
KnutSv
<plugin-development><templating>
Setting template mode to CP doesn't let me load plugin templates
# Setting template mode to CP doesn't let me load plugin templates

(Asked by: username_0 on 2016-08-31)

Setting template mode to CP with `craft()->templates->setTemplateMode(TemplateMode::CP)` only lets me load templates from `app/templates`.

If i load `app/templates/entries/_fields.html` and I use custom fields in the entry, this will attempt to load those edit templates from `plugins/{pluginName}/templates` and I receive an error because the templates could not be found in `app/templates`.

Shouldn't templateMode -> CP behave more like proper CP and not just set a single load path?

**Tags:** plugin-development, templating

> **Comments:**
> **username_1**: I'm not sure I'm following what you're after 100%, maybe you're looking to call `craft()->templates->setTemplatesPath()` directly and give it your plugin's template path?  
> **username_0**: @BradBell I know I can do that, but I can't include a plugin template that includes a CP-template, or a CP-template that includes a plugin-template. Say that I include `app/templates/entries/_fields.html` and the entry has a Neo-matrix, or Supertable or something like that, then I get template errors because the CP-template is trying to include templates that only exists in the respective plugin(s)  

---

## 0 answers

