From CakePHP docs (focus):
The render () method is automatically called at the end of each requested controller action. This method executes all the presentation logic (using the data that you specified when using the set () method), places the view inside its layout and returns it to the end user .
But, if you look at the source for AppController::render
, it returns the processed output back to the calling method. So, theoretically you can do something like:
$this->autoRender = false; $outp = $this->render('myView'); // do cleanup stuff echo $outp; exit();
As long as your autoRender
set to false, you should be good. I personally have not tried this, but it looks like it should work the way you want. Good luck
source share