<radischm@googlemail.com> wrote:
>
> Hello together,
>
> i installed the search_index correct(http://code.google.com/p/
> searchable-behaviour-for-cakephp/). I workes very fine. :) So now i
> tried to search, on an empty
> table. How can i get if the result is normally empty. For example the
> word is not in DB Table
>
> I tried it so in the controller of my application
> function search(){
> if(empty($this->set('results',$this->Translate->search($this->data
> ['Translate']['q']))))
> {
> $this->Session->setFlash("Not Data found with these
> searchword");
> }
> else {
> $this->Session->setFlash("test");
> }
>
> but it doesn't work
> How do i this in the best way.
> Many greetings
>
Try this:
$results = $this->Translate->search($this->data['Translate']['q']);
if (empty($results))
{
$this->Session->setFlash("...");
}
else
{
$this->set('results', $results);
$this->Session->setFlash("...");
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment