The controller:
controllers |-FooController.php |-BarController.php
The views:
view |-foo| | |-index.php | |-error.php | |-bar| |-index.php
How to render the error.php view with an action of the bar controller? I have tried:
$this->render('foo/error');
But it doesn't work.
try this
$this->render('//foo/error');
If you don't echo it, you will get a blank page. The correct way is
<?= $this->render('//foo/error'); ?>
or
<?php echo $this->render('//foo/error'); ?>
This also works for Yii2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With