Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render view Yii2

How do you render a view file in the profile module's index view file. I tried this:

<?=$this->render('/product/product/_search')?>

This is the error I get:

The view file does not exist: C:\OpenServer\domains\zuppermart\frontend\modules\profile\views\product/product/_search.php`

I also tried <?=$this->render('//product/product/_search')?>

And I get this error:

The view file does not exist: C:\OpenServer\domains\zuppermart\frontend\modules\profile\views\profile\modules//product/product/_search.php

like image 719
Fuad Ibrahimov Avatar asked May 19 '15 09:05

Fuad Ibrahimov


1 Answers

According to given paths, it should be like this (absolute path specified via alias):

<?= $this->render('@frontend/modules/product/_search') ?>

But note that you are trying to render view from another module, I think it's better to create widget instead.

Official docs:

  • View render()
  • Widget
like image 60
arogachev Avatar answered Sep 19 '22 07:09

arogachev