render a view from another controller, yii

Cedric picture Cedric · Feb 11, 2014 · Viewed 30.8k times · Source

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.

Answer

Let me see picture Let me see · Feb 11, 2014

try this

$this->render('//foo/error');