Is there a way to render a controller to a different view then normal? I\'m trying to pass some data from the controller to a non-default view. Meaning my controller is called:<
I would rather use:
$this->view = 'file';
because any $this->set('var', $val)
you'll have after $this->render('file')
will not reach your view.
In CakePHP 3.x use:
$this->viewBuilder()->template('file');
Deprecated in CakePHP 3.7. Use this instead (as Kuldeep Choudhary suggested in comments)
ViewBuilder::setTemplate('file');