Two ways of doing this:
-
Load it in advance (like you’re doing) and pass to the other view
<?php // the "TRUE" argument tells it to return the content, rather than display it immediately $data['menu'] = $this->load->view('menu', NULL, TRUE); $this->load->view ('home', $data);
-
Load a view “from within” a view:
<?php // put this in the controller $this->load->view('home'); // put this in /application/views/home.php $this->view('menu'); echo 'Other home content';