我的yii(2)应用程序的结构如下:
___Backend ___frontend______ | |__ controllers | | |__ SiteController.php | | |__ ... (other controllers goes here...) | |__ models | |__ views | | | __ | | : | |__ themes(my theme) |__CompanyProfile |__Index.php |__CSS |__fonts |__...
我使用下面的代码在yii 1中渲染: (yii 1)
public function actionPages($id){
Yii::app()->theme = 'CompanyProfile';
$this->renderPartial('CompanyProfile/views/layouts/Index',array(
'model'=>PrCompany::model()->findByPk($id),
));
}`
但是我没有设法在yii2中使用renderPartial。我如何在yii 2中使用renderPartial
答案 0 :(得分:-1)
试
public function actionPages($id){
$this->renderPartial('@frontend/themes/CompanyProfile/views/layouts/Index',array(
'model'=>PrCompany::model()->findByPk($id),
));
}`