Reputation: 104
How can I send data to other view from controller?
function index()
{
if(!empty($this->data))
{
$projects = $this->Hour->getProjectsByDate($this->data);
**//here I have to redirect $projects to another view.**
}
$this->set('projects', $this->Project->find('list', array('conditions' =>
array('Project.active' => true))));
}
Thank you! :)
Upvotes: 0
Views: 2407
Reputation: 352
Try adding this after your $this->set('projects', $this->Project->find('list', array('conditions' =>
array('Project.active' => true))));
:
$this->render('whatever view you want');
Don't forget to set your variables before you render a different view:
function index()
{
if(!empty($this->data))
{
$projects = $this->Hour->getProjectsByDate($this->data);
**//here I have to redirect $projects to another view.**
//You should set your variables first before you render a different view:
$this->set('projects', $this->Project->find('list', array('conditions' =>
array('Project.active' => true))));
//Then render a different view
$this->render('some other view');
}
}
Upvotes: 2