I need to display a partial view inside the component's user file in Yii2 and according to the Yii docs you can access the view instance through something like this:
\Yii::$app->view->renderFile('@app/views/site/license.php');
I went ahead and tried:
Yii::$app->view->renderPartial('//my/view/');
... but then received an error message that I was trying to access a nonexistent method.
Then I checked the view class and noticed that it does not have renderPartial , and this is the controller method.
I see that it has a renderFile method and a render method; which one should i use?
The docs don't indicate that the render method includes a layout, such as a method with the same name, from a controller class, so I'm not sure; as for renderFile I'm not 100% sure if this fits or?
Can someone explain which method will produce the same results as renderPartial ?
source share