i have this:
class SubcatHelper extends Helper {
function find($id){
$subcat = $this->Subcat->Cat->find('all',array('conditions' =>
array('Subcat.status' => 1,'Subcat.id'=>2)));
return $subcat;
}
}
in SubcatsController this code
$usercats = $this->Subcat->Cat->find('all',array(
'conditions' => array(
'Cat.status' => 1
)));
work but in subcathelper i have this error
Notice (8): Undefined property: SubcatHelper::$Subcat [APP\views
\helpers\subcat.php, line 8]
Code | Context
function find($id){
$subcat = $this->Subcat->Cat->find('all',array('conditions' =>
array('Cat.status' => 1)));
$id = 2
SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
include - APP\plugins\spark_plug\views\users\index.ctp, line 29
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line
913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
Notice (8): Trying to get property of non-object [APP\views\helpers
\subcat.php, line 8]
Code | Context
function find($id){
$subcat = $this->Subcat->Cat->find('all',array('conditions' =>
array('Cat.status' => 1)));
$id = 2
SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
include - APP\plugins\spark_plug\views\users\index.ctp, line 29
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line
913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
Fatal error: Call to a member function find() on a non-object in D:
\xampp\htdocs\ird\www\app\views\helpers\subcat.php on line 8
how can i use some function in helper like function in Controller?
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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