Codeigniter: easiest way to use variables between models and controllers, models and models, controllers and controllers Codeigniter: easiest way to use variables between models and controllers, models and models, controllers and controllers codeigniter codeigniter

Codeigniter: easiest way to use variables between models and controllers, models and models, controllers and controllers


You cannot access a variable if it's in a seperate file, instead you should set it in your class.

class User_model extends Model {    // Declare the foo variable    public $foo = "";    function blah() {        // You can set variable foo this way from any controller/model that includes this model        $this->foo = "dog";        // You can access variable foo this way        echo $this->foo;    }}