1

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'],
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.