Welcome Guest, Not a member yet? Register   Sign In
mvc all in one file
#5

[eluser]Pascal Kriete[/eluser]
What I would do here is to place it all in the global controller:

libraries/MY_Controller.php:
Code:
class BaseController extends Controller {
    function BaseController()
    {
        parent::Controller();

        //load model, do operations, etc
        $data['bla'] = stuff;
        $this->load->view('header');
    }
}

Then you make all your Controllers extend BaseController instead of just Controller. And voila, that code get's called for all of them.

Also, as long as you only get data from the model in a view, it is perfectly acceptable MVC. The view just shouldn't write to the model.


Messages In This Thread
mvc all in one file - by El Forum - 03-24-2008, 12:50 PM
mvc all in one file - by El Forum - 03-24-2008, 01:43 PM
mvc all in one file - by El Forum - 03-24-2008, 01:50 PM
mvc all in one file - by El Forum - 03-24-2008, 01:59 PM
mvc all in one file - by El Forum - 03-24-2008, 02:14 PM
mvc all in one file - by El Forum - 03-24-2008, 02:15 PM
mvc all in one file - by El Forum - 03-24-2008, 04:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB