Yii Framework Forum: How to change the layout of controller in yii2 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to change the layout of controller in yii2

#1 User is offline   Questions 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 15-October 16

Posted 22 September 2017 - 09:43 AM

I am using yii2 basic

I have implemented Admin LTE.

Now when admin logs in, on sidebar there is menu called Dashboard, where many statistics should be displayed.

I have created controller called DashboardController and linked to the menu. But the layout is different. It doesn't get included in content section of Admin LTE. (A separate blank page is displayed)
0

#2 User is offline   umneeq 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 162
  • Joined: 10-October 11
  • Location:Russia

Posted 26 September 2017 - 11:20 AM

You can set layout in action:

public function actionIndex() {
    $this->layout = 'blabla';
}


If you use module you can configure layout through config:
'modules' => [
        'admin' => [
            'class' => 'frontend\modules\admin\Module',
            'layout' => '@admin/views/layouts/main'
        ],
    ],

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users