Search code examples
model-view-controlleryii2yii2-extension

Yii2 Render view from extension


I have Yii2 application which has a regular controller with regular action and its view trying to render a view that's part of an extension. My view is in the 'views/controllerName' folder and I'm trying to reach a view which is in 'vendor/providerName/extensionName/views/extensionController'. What is the right way to do that?

I'm tried the regular render() method with different strings like: extensionController/extensionView, /extensionController/extensionView, //extensionController/extensionView but I keep getting an error message that the file is not found in the main view folder which is not where I want the framework to look at first place.


Solution

  • e.g.

    echo $this->render('@vendor/firephp/test');
    

    so in your case

    echo $this->render('@vendor/providerName/extensionName/views/extensionController');