Calling a public controller method from a view? |
[eluser]esra[/eluser]
[quote author="Base Willy" date="1194874127"]I've aksed the same question a little time ago and we decided that the calling a controller from the view isn't right and it's better to use models[/quote] You can also use one or more helpers loaded by the controller, then execute helper functions from your views. You need to create an instance of the CI super object in the helper if you want to access a database from within a helper.
[eluser]wiredesignz[/eluser]
Quote:... the controller takes the user input, then asks the model what to do, the wise model answers and then the controller takes that raw data and passes it over the view, which is nothing more than a presentational element Rubbish. (Your signature is relevant obviously) In MVC, The controller is NOT a Mediator between the view and the model. The controller does not sit in between the model and the view. Both the controller and the view have equal opportunity to access the model. The view generally have free access to the model, but should not change the state of the model. Views are read only representations of the state of the model. The view reads data from the model using query methods provided by the model. http://www.phpwact.org/pattern/model_view_controller |
Welcome Guest, Not a member yet? Register Sign In |