Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change layout file within a view in Yii2

Tags:

I am doing a small project using Yii2.

Suppose I have same layout (header, footer) in a view (eg site) except a login.php in this view. I want a different or no header / footer in this file. What can I do the remove the header / footer only from this view file.

All I could get to change layout in different views. Is it possible to change layout in a single file of a view?

like image 995
Moid Avatar asked May 01 '15 06:05

Moid


1 Answers

Inside the relative action:

public function actionYourAction($id) {      $this->layout = 'yourNewLayout';      return $this->render('yourView', [         'model' =>$model,     ]); } 
like image 101
ScaisEdge Avatar answered Sep 25 '22 13:09

ScaisEdge