mohsen bahmani
mohsen bahmani

Reputation: 31

How to have multi layouts in yii2

I am beginner in yii2, there are two page in my project, one for public user and one for registered users. Now how can i have two layouts in layouts folder and how can i to render in controller?

Upvotes: 1

Views: 1549

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133400

You can create all the layout you want in view/layout ..

You can set the layout in controller .

public function actionEvent()
{
    $this->layout = 'you_layout';

   return $this->render('event' ,['dataProvider' => $dataProvider]);
}

Upvotes: 1

Related Questions