[eluser]ariok[/eluser]
Ok it's perfect.. but now i have another problem
This is an overview of my situation :
-A main layout where is defined my site structure and where contents are loaded
-Suppose that i have only 2 sections Home and Contacts
-i defined 2 controller and 2 views for home and contact as described in previous posts and
1 view for main_layout where i print a $content variable value..
here the problem.. i need to print an information from a DB, and this info must be visible in all pages... but i think that it's not correct to do something like this
Code:
function Home() {
parent::Controller();
//HERE--------------------------
$data['content'] = $this->load->view("home_view","",true);
$this->load->model('Info');
$data['information'] = $this->Info->get_info();
//------------------------------
$this->load->view("main_tpl",$data);
}
And do the same for contacts
Code:
function Contacts() {
parent::Controller();
//HERE--------------------------
$data['content'] = $this->load->view("contacts_view","",true);
$this->load->model('Info');
$data['information'] = $this->Info->get_info();
//------------------------------
$this->load->view("main_tpl",$data);
}
In this mode.. i need to repeat
Code:
$this->load->model('Info');
$data['information'] = $this->Info->get_info();
in all controller... and get this data in main layout ...
is there an better way without repeat this info in all controllers?????