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:<
class StocksRealtimeController extends AppController
{
var $uses = 'StockRealtime';
function index( )
{
$this->layout = NULL;
$this->autoRender = false;
$this->set('stocksRT', $this->StockRealtime->find('all'));
return $this -> render('/TestView/index');
/*
$this -> render('/TestView/index');
Here 'TestView' must be a Folder named same as "public $name" variable value
in Controller and an "index.ctp" must be situated under TestView Folder.
'index'
*/
}
}
Give it a try, return 'KEYWORD' must be there to render view page successfully. Sorry about 2nd question as i didn't get it. According to CakePHP, variable [stocksTR] which is set using $this -> set( ) , also will be available at manually render view page [ 'index.ctp' ].