$this->render('index');

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

$this->render('index');

Maxwell Ochieng
I have tried for two days now to figure out why $this->render('index'); is not working on my controller method,here is the controller action I am running $this->render('index');
Thanks.
public function search(){
if($this->request->is('put') || $this->request->is('post')){
return $this->redirect(array(
'?'=>array(
'q'=>$this->request->data('User.searchQuery')
)
));
$this->User->recursive = 0;
$searchQuery=$this->request->query('q');
$this->Paginator->settings = array(
 'User'=>array(
   'findType'=>'search',
 'searchQuery'=> $searchQuery
 )
 );
$this->set('users',$this->Paginator->paginate());
$this->set('searchQuery',$searchQuery);
//$this->autoRender = false;
   $this->render('index');
}
}

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: $this->render('index');

John Andersen
Is that the whole search method in your controller?

If yes, then the render call is inside the if statement at the beginning and will thus not be invoked due to the return statement just after the if statement.

Enjoy, John

On Saturday, 30 January 2016 06:32:22 UTC+2, Maxwell Ochieng wrote:
I have tried for two days now to figure out why $this->render('index'); is not working on my controller method,here is the controller action I am running $this->render('index');
Thanks.
public function search(){
if($this->request->is('put') || $this->request->is('post')){
return $this->redirect(array(
'?'=>array(
'q'=>$this->request->data('User.searchQuery')
)
));
$this->User->recursive = 0;
$searchQuery=$this->request->query('q');
$this->Paginator->settings = array(
 'User'=>array(
   'findType'=>'search',
 'searchQuery'=> $searchQuery
 )
 );
$this->set('users',$this->Paginator->paginate());
$this->set('searchQuery',$searchQuery);
//$this->autoRender = false;
   $this->render('index');
}
}

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.