<p>The correct path would be </p>

<pre><code>return Craft::$app-&gt;getView()-&gt;renderTemplate('subscribing-module/templates/default',['mypost' =&gt; $request]);
</code></pre>

<p>And the file lives in <code>modules/subscribingmodule/src/templates/default/index.twig</code></p>

CC BY-SA 4.0
2019-10-08T09:05:13.747Z
2019-10-08T09:05:13.747Z
Christopher Dosin
<p>Module loads and controller actions work. Craft 3.3.7.</p>

<p>I'm trying to find out what is the path to use to render the view.</p>

<p>From the Doc:</p>

<pre><code>return $this-&gt;renderTemplate('plugin-handle/path/to/template', $variables);
</code></pre>

<p><a href="https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates" rel="nofollow noreferrer">https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates</a></p>

<p>What I have and doesn't work:</p>

<pre><code>return Craft::$app-&gt;getView()-&gt;renderTemplate('subscribing-module/src/views/default/index',['mypost' =&gt; $request]);
</code></pre>

<p>Returned error for above: Unable to find the template “subscribing-module/src/views/default/index”.</p>

<p>Here is the direct path from the root of the website:
modules/subscribingmodule/src/views/default/index.php</p>

<p>Bootstrap in config/app.php:</p>

<pre><code>'bootstrap' =&gt; ['subscribing-module'],
</code></pre>

<craft3><php><yii>
Custom module controller getView()->renderTemplate() path not working
# Custom module controller getView()->renderTemplate() path not working

(Asked by: username_0 on 2019-10-08)

Module loads and controller actions work. Craft 3.3.7.
I'm trying to find out what is the path to use to render the view.
From the Doc:
return $this->renderTemplate('plugin-handle/path/to/template', $variables);

https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates
What I have and doesn't work:
return Craft::$app->getView()->renderTemplate('subscribing-module/src/views/default/index',['mypost' => $request]);

Returned error for above: Unable to find the template “subscribing-module/src/views/default/index”.
Here is the direct path from the root of the website:
modules/subscribingmodule/src/views/default/index.php
Bootstrap in config/app.php:
'bootstrap' => ['subscribing-module'],

**Tags:** craft3, php, yii

---

## 1 answers

### Answer by username_1 on 2019-10-08. Score: 2 | Accepted answer

The correct path would be 
return Craft::$app->getView()->renderTemplate('subscribing-module/templates/default',['mypost' => $request]);

And the file lives in modules/subscribingmodule/src/templates/default/index.twig


---

