[eluser]Twisted1919[/eluser]
Usually, when using $this->data, you do it when you have a MY_Controller and extend your controllers from it, assuming that in your MY_Controller, you set information in $this->data that will be globally available in other controller that extends it.
If you don't have a MY_Controller, then you can go like
Code:
class Site extends Controller{
public $last_models;
public function __construct()
{
parent::Controller();
$this->last_models = $this->ANY_GLOBAL_MODEL->ANY_METHOD_WITHIN_MODEL();
// now, accessing $this->last_models in each of your class methods will give you the expected result.
}
public function home()
{
$data = array(
'title'=>'This is the title',
'pagina'=>'home'
);
// you can do like this :
$data['last_models'] = $this->last_models;
//or, if you have many properties and you are lazy like i am
$data = array_merge($data,get_object_vars($this));
// in both cases, if accessing $last_models in the view, will give you the correct result.
}
}