Tuesday, October 4, 2011

Rendering a specific view in cakePHP

In your controller you may want to render a different view than what would conventionally be done.

You can do this by calling render() directly. Once you have called render() CakePHP will not try to re-render the view:


class PagesController extends AppController {

function your_action() {
$this->render('custom_file');
}
}

This would render app/View/Pages/custom_file.ctp instead of app/View/Pages/your_action.ctp