CodeIgniter Forums
One method - many views - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: One method - many views (/showthread.php?tid=12490)



One method - many views - El Forum - 10-21-2008

[eluser]nws123[/eluser]
How to in one method add many views ?

Code:
public function active()
    {
        $this->load->model('survey_model');
        $this->load->library('auth');
        $this->data = array('survey' =>  $this->survey_model->loadPublished($this->auth->getUser()->userId));
        $this->load->library('design');
        $this->design->header('header_logged');
                //one view i need 4
        $this->load->view('/survey/active',$this->data);
        $this->design->footer('footer_logged');
        
    }



One method - many views - El Forum - 10-21-2008

[eluser]xwero[/eluser]
Can you give more information? Are the 4 view parts of one page or are it 4 different contents?


One method - many views - El Forum - 10-21-2008

[eluser]nws123[/eluser]
Content from 1 table on 4 pages


One method - many views - El Forum - 10-21-2008

[eluser]Sam Dark[/eluser]
Add another 4 methods that are using fifth to get data?


One method - many views - El Forum - 10-23-2008

[eluser]alx_benjamin[/eluser]
Do this:

Code:
$this->load->view('header',$this->data);
$this->load->view('body');
$this->load->view('footer');

once loaded $this->data will be accessible within every page (header, body and footer)

Regards