I have a controller say class_controller.php. But I don’t want to create its view. So what should be written in the controller?
I like if you don’t want any model to be related we use var $uses = null; likewise what is the code for not relating to its view?
It is easy to disable both the layout and view in CakePHP by putting the following line in your controller action:
$this->autoRender = false;If you want to disable just the layout, use the following line in your controller action:
$this->layout = false;And if you only want to disable the view for this action, use the following line in your controller:
$this->render(false);Note: This will be action specific and not controller as you have asked for.
You can do the trick using
beforeFilter()function which will call before every action in your controller & disable layout for you.