Hi,
sometimes and only sometimes I get this error:
Undefined property: View::$Bookmark [*CORE\Cake\View\View.php*, line *804*]
*Fatal error*: Call to a member function countBookmarks() on a non-object
in *D:\SVN-Homes\PHP\trunk\project\View\Layouts\default.ctp* on line *59*
*
*
default line 59: <?php echo $this->Bookmark->countBookmarks();?>
The helper is included in my AppController
public $helpers = array(...'Bookmark'...');*
*
BookmarkHelper.php
App::uses('AppHelper', 'View/Helper');
class BookmarkHelper extends AppHelper {
public function countBookmarks(){
if(CakeSession::check('Auth.User')){
$Model=& ClassRegistry::init('Bookmark'); //debug($Model);
$Model->recursive = -1;
$data = $Model->find('count', array('conditions' =>
array('boo_fkid_usr_id = '.CakeSession::read('Auth.User.usr_id'))));
return $data;
}
if(CakeSession::check('bookmarks')){
return count(CakeSession::read('bookmarks'));
}
return 0;
}
I really wonder, why this error happens... and only from time to time....
Any Ideas?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php