Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change cakephp default.ctp layout directory?

Tags:

cakephp

Individually I am able to change cakephp default layout by using controller.For example I have used

public function login() {
    $this->layout="make";  //here I have changed layout for single action

        if ($this->request->is('post')) {
            //some code...
        } 
   }

Here I have changed layout!! But the problem is this layout is not default.I want to apply this layout for all controller.How can I do this?

like image 280
Alimon Karim Avatar asked Mar 24 '14 10:03

Alimon Karim


People also ask

How do I change the default layout in CakePHP?

CakePHP's default layout is located at /app/View/Layouts/default. ctp . If you want to change the overall look of your application, then this is the right place to start, because controller-rendered view code is placed inside of the default layout when the page is rendered.

What is layout in CakePHP?

Layouts. A layout contains presentation code that wraps around a view. Anything you want to see in all of your views should be placed in a layout. CakePHP's default layout is located at templates/layout/default. php.


1 Answers

In your AppController

public function beforeRender() {
    parent::beforeRender();

    $this->layout = 'custom';
}
like image 197
mark Avatar answered Sep 28 '22 19:09

mark