我正在尝试在模块中获取工作布局。所以我在名为“adminLayout”的模块的视图文件夹中创建了一个布局
假设AdminModule.php
init() 方法中的布局。所以现在它看起来像这样:
public function init()
{
$this->layoutPath = Yii::getPathOfAlias('application.modules.admin.views.layouts');
$this->layout = 'adminLayout';
// this method is called when the module is being created
// you may place code here to customize the module or the application
// import the module-level models and components
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
}
但由于某种原因布局不适用于模块。我尝试将“public $layout”添加到控制器并且它有效。
无法弄清楚是什么问题。
我也尝试将布局设置添加到main.php
配置文件夹中,但仍然没有任何操作。如果有人可以提供帮助,将不胜感激。