Welcome Guest, Not a member yet? Register   Sign In
is'this correct? (Load content from a view)
#5

[eluser]ariok[/eluser]
Ok it's perfect.. but now i have another problem Sad
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?????


Messages In This Thread
is'this correct? (Load content from a view) - by El Forum - 08-05-2007, 10:04 AM
is'this correct? (Load content from a view) - by El Forum - 08-05-2007, 01:46 PM
is'this correct? (Load content from a view) - by El Forum - 08-05-2007, 07:27 PM
is'this correct? (Load content from a view) - by El Forum - 08-06-2007, 03:54 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 04:38 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 04:54 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:11 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:22 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:33 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:44 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:47 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 05:55 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 06:04 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 06:23 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 06:29 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 06:43 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 07:01 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 07:30 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 07:46 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:07 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:11 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:13 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:26 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:32 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:36 AM
is'this correct? (Load content from a view) - by El Forum - 08-07-2007, 08:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB