Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

render a blank view in cakephp

Tags:

view

cakephp

i need to prevent a view to be rendered in a specified case but i can't understand how to prevent it to render.

I tried

$this->autoRender=false

but nothing happened, probably because i'm using an API engine that manage rendering differently from regular controllers. Anyone know any trick to do this?

like image 683
Chobeat Avatar asked Jan 02 '12 12:01

Chobeat


2 Answers

It's an old question. The current cake-version is 3.x and there is a easy way to use a blank layout.

Only add the in the controller:

$this->viewBuilder()->autoLayout(false);
like image 69
bastey Avatar answered Sep 28 '22 07:09

bastey


Using $this->layout = 'ajax' does not seem to be enough.

But using these both lines works:

$this->layout = 'ajax'; 
$this->render(false);
like image 41
Samuel Avatar answered Sep 28 '22 05:09

Samuel