0

i have a module called 'elite' which render articles and another module called 'inet'.

Inet->controllerX need to get the HTML only from an article(elite->article->actionView).

so my question is:

should i call elite->article->actionView from another module or use components and inheritance and how?

Thank you!

  • Does this answer your question? [render a view from another controller, yii](https://stackoverflow.com/questions/21699309/render-a-view-from-another-controller-yii) – Pentium10 Nov 04 '20 at 19:42
  • https://stackoverflow.com/questions/39303876/yii2-render-module-view-from-main-application This will help you. – Ketan Vekariya Nov 05 '20 at 01:37
  • You might want to take a look at [widgets](https://www.yiiframework.com/doc/guide/2.0/en/structure-widgets). From the maintainability point of view I don't think using view templates across modules is good idea. – Michal Hynčica Nov 06 '20 at 16:02

1 Answers1

0

You can easily render a view in any module, just need view path.

return $this->render('@app/modules/elite/views/name_controller/name_view');

You must replace the name of the controller and the name of the view.