我正在嘗試在模塊中獲取工作佈局。因此,我在模塊的視圖文件夾中創建了一個佈局,名爲'adminLayout'Yii模塊佈局
假設init()方法中的AdminModule.php
中的佈局。 所以現在看起來是這樣的:
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.*',
));
}
但由於某些原因的佈局並不適用於模塊。我試圖添加「公共$佈局」控制器,它的工作原理。
找不出什麼問題。
另外我試圖在config文件夾中添加布局設置到main.php
,但仍然沒有任何操作。如果有人能幫忙,請多多指教。
非常感謝你 – timofeiMih