Welcome Guest, Not a member yet? Register   Sign In
Question about the MVC pattern
#4

[eluser]wiredesignz[/eluser]
MVC design pattern states that a view may access the model directly, but it may not alter the model state.

So the call to model->fetch() should be implemented in the controller and if the resultset is stored in the model then the view can access it directly.

In fact CI actually creates a reference to the model for you to use in a view
Code:
-controller----------------------

$this->db_model->fetch(); //get the data

$this->load->view('main');

-view----------------------------

foreach($this->db_model->resultset as $out): //get the result from the model


Messages In This Thread
Question about the MVC pattern - by El Forum - 07-11-2008, 11:05 AM
Question about the MVC pattern - by El Forum - 07-11-2008, 04:33 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 08:05 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 08:28 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 09:40 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 09:41 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 10:24 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 10:42 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 10:58 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 10:59 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 11:02 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 11:05 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 11:17 PM
Question about the MVC pattern - by El Forum - 07-11-2008, 11:22 PM
Question about the MVC pattern - by El Forum - 07-12-2008, 12:40 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 02:17 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 07:13 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 08:43 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 09:09 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 09:30 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 09:39 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 09:48 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 10:29 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 11:04 AM
Question about the MVC pattern - by El Forum - 07-12-2008, 01:07 PM
Question about the MVC pattern - by El Forum - 07-12-2008, 06:51 PM
Question about the MVC pattern - by El Forum - 07-12-2008, 08:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB