Closed ahmadasjad closed 5 years ago
1: Add theme config
'view' => [ 'theme' => [ 'basePath' => '@app/themes/abc', 'baseUrl' => '@web/themes/abc', 'pathMap' => [ '@app/views' => '@app/themes/abc', ], ], ],
2: Call inside any module module: report controller: student action: xyz $this->render('//base-view/xyz', ['var_name' => 'some_value']);
$this->render('//base-view/xyz', ['var_name' => 'some_value']);
3: File should be like below: theme-dir/abc/base-view/xyz.php
theme-dir/abc/base-view/xyz.php
The view should be found from the following path: app-dir/theme-dir/abc/views/base-view/xyz.php
app-dir/theme-dir/abc/views/base-view/xyz.php
**View not Found – yii\base\ViewNotFoundException** The view file does not exist: app-dir/modules/report/views/student/base-view/xyz.php
**View not Found – yii\base\ViewNotFoundException**
app-dir/modules/report/views/student/base-view/xyz.php
When tried to give an example with fresh yii2 repo, it worked. It seems to some config issue with my project.
What steps will reproduce the problem?
1: Add theme config
2: Call inside any module module: report controller: student action: xyz
$this->render('//base-view/xyz', ['var_name' => 'some_value']);
3: File should be like below:
theme-dir/abc/base-view/xyz.php
What is the expected result?
The view should be found from the following path:
app-dir/theme-dir/abc/views/base-view/xyz.php
What do you get instead?
**View not Found – yii\base\ViewNotFoundException**
The view file does not exist:app-dir/modules/report/views/student/base-view/xyz.php
Additional info