Welcome Guest, Not a member yet? Register   Sign In
Sending data from one controller to another
#5

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

Code:
$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...

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

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

Code:
$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.

Code:
$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.

DMyers
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB