whats the best way to show the user if there is no items found
any code i can use in my view
this i used but didnt work i got error
<?php
if (!$item) {
echo'<p> no items found found</p>';
}
?>
this is in my post controller
function search($item = null) {
$item = $this->params['url']['q'];
$post = $this->Post->find('all',
array('conditions' => array(
'AND' => array(
'OR' =>array(
'Post.name LIKE' => '%' . $item . '%',
'Post.date LIKE' => '%' . $item . '%',
'Post.poster LIKE' => '%' . $item . '%'),
'NOT'=>array('Post.active'=> '0'))),
'order' => 'Post.name',
'recursive' => 1));
if (!$item) {
$this->Session->setFlash(__('No Search Items Found',
true));
$this->redirect(array('action'=>'index'));
}
$this->set('search', $posts);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---