Welcome Guest, Not a member yet? Register   Sign In
What's your opinion on where models are executed: controllers or views?
#11

[eluser]michaeljdennis[/eluser]
Yes definitely in the controller. I always make model and view calls from the controller.
#12

[eluser]InsiteFX[/eluser]
Read my sig...

Enjoy
InsiteFX
#13

[eluser]Clever Mind[/eluser]
hello guys...

Definetely, Data should pass to view through the controller and also model will be called by controller for any database releted works . Its a theory of MVC architecture.

Thanks
#14

[eluser]n0xie[/eluser]
[quote author="Clever Mind" date="1270025169"]hello guys...

Definetely, Data should pass to view through the controller and also model will be called by controller for any database releted works . Its a theory of MVC architecture.

Thanks[/quote]
[nitpicking mode]

Actually MVC states that the View 'talks' to the Model. The implementation of CI is not 'true' MVC since the Model has no interaction (or at least it's highly discouraged) with the View part. In proper MVC the flow of an application is as follows:
Quote:
1. The user interacts with the user interface in some way (for example, presses a mouse button).
2. The controller handles the input event from the user interface, often via a registered handler or callback and converts the event into appropriate user action, understandable for the model.
3. The controller notifies the model of the user action, possibly resulting in a change in the model's state. (For example, the controller updates the user's shopping cart.)
4. A view queries the model in order to generate an appropriate user interface (for example, the view lists the shopping cart's contents). Note that the view gets its own data from the model. The controller may (in some implementations) issue a general instruction to the view to render itself. In others, the view is automatically notified by the model of changes in state (Observer) which require a screen update.

5. The user interface waits for further user interactions, which restarts the cycle.

This doesn't mean that CI (or any of the PHP-MVC frameworks for that matter) got it wrong, but originally the MVC pattern was used in 'desktop'-applications. The port towards web-application is a recent one and the translation is not flawless. What most PHP-MVC frameworks actually use is PAC.
[/nitpicking mode]




Theme © iAndrew 2016 - Forum software by © MyBB