Obviously, your model does not exist in AppController. Did you put var $uses = array('WhosOnline'); in there?
If you did, try putting a debug($this) in your controller and look at the dump, maybe it's there but not called WhosOnline? On Jun 18, 12:47 pm, Sanfly <[EMAIL PROTECTED]> wrote: > Okay, so Im trying this out, but have run into a problem, im getting > the following error, and I cant figure out where I'm going wrong: > > Fatal error: Call to undefined method stdClass::save() in G:\WAMP > \www\UASC Sourceforge\trunk\app\app_controller.php on line 60 > > I have a table whos_online > > I have a model whos_online.php with the following: > > class WhosOnline extends AppModel { > var name = 'WhosOnline'; > var $useTable = 'whos_online'; > var $belongsTo = array( > 'Member' => > array('className' => 'Member', > 'foreignKey' => 'member_id', > ) > ); > > } > > in my app controller beforeFilter im trying to save some data into the > database > > function beforeFilter(){ > > $online['sesson'] = session_id(); > $online['location'] = $_SERVER['REQUEST_URI']; > $online['session_time'] = date("Y-m-d H:i:s"); > > if($this->Session->check("member_id")){ > $online['member_id'] = > $this->Session->read("member_id"); > } > else{ > $online['member_id'] = "0"; > } > $this->WhosOnline->session = session_id(); > $this->WhosOnline->save($online); // Line 60 > > } > > On Jun 18, 3:56 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > > > > > > > On Wed, Jun 18, 2008 at 7:58 AM, Sanfly <[EMAIL PROTECTED]> wrote: > > > > If I have a function or script that I want to execute automatically on > > > every page of my website, how would I go about it? > > > The correct CakePHP terms would be I have a function that I want to execute > > before every action > > > - rewording it that way makes the answer obvious - create a beforeFilter in > > your app_controller > > > T > > > -- > > ============================================================= > > Cheesecake-Photoblog:http://cheesecake-photoblog.org > > PHP for E-Biz:http://sanisoft.com > > ============================================================= > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---