[Help] remove default layout from view

The layout directory looks like this (default webapp):




|-layout

  |--column1.php

  |--column2.php

  |--main.php



CController contains this line




class Controller extends CController

{

	/**

	 * @var string the default layout for the controller view. Defaults to '//layouts/column1',

	 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.

	 */

	public $layout='//layouts/column1';

	/**

}



I added this on my controller but it didn’t help


    

    public function init()

    {

        $this->layout = '';

    }



It just disabled the style on column1 but still rendered the main layout.

You might appreciate renderPartial – see this thread or just search the site

If you will be using renderPartial, there’s no need to set public $layout to something.

How about set empty to $layout?




class Controller extends CController

{

	/**

	 * @var string the default layout for the controller view. Defaults to '//layouts/column1',

	 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.

	 */

	public $layout='';

	/**

}



Setting layout to false should do.




    public function init()

    {

        $this->layout = false;

    }



CController::getLayoutFile()

BTW, why do you want to remove the layout? I mean, it’s a useful mechanism to give your site a consistent looking and eliminate some repetitive coding. I would not go without it, although I would use my own customized version. :)

Thank you for all your replies I will consider every option