• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending data from one controller to another

Just off the top of my head I would probably add a "type" parameter

$this->mylog_model->writelog('controller','Read Active Customer IDs');

Then in the write log method I could make it do all kinds of special magic based on the type.

For example run a debug_backtrace() and grab all kinds of stuff about who called you as well as anything available to the CI Input Class, URI Class objects, User Agent Class, Session Library, etc...

$this->mylog_model->writelog('model','Read Blog Entry');

this might grab the database stats or something since you specified it as a model type?

$this->mylog_model->writelog('generic','Read Blog Entry 23');

Do nothing special but log that entry.

That of course could also be a column in itself called "type" which you could filter on later.

You could also just send in a instance of who ever is calling the method ie.

$this->mylog_model->writelog($this,'Do Something');

Then you could look at the $this parameter in the method and determine what to do? Everything (public) available to the caller would be available to the writelog method.


Messages In This Thread
RE: Sending data from one controller to another - by dmyers - 04-20-2016, 10:44 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.