by unni » Thu Apr 29, 2010 1:45 am
Hi, I have stopped my last post on the fly to learn CI is by saying about to begin MVC architechture study,
So, What is MVC or Non MVC Web developement?
Non MVC scripts looks as the follwing..
<html>
<?php PHP code ?>
<body>
<?php PHP code integrated ?>
[html code] <?php php code ?> [html code ends]
</body>
</html>
And
MVC basically means that the PHP and HTML are separated. The main aim of the MVC architecture is to separate the business logic part and application data from the presentation data to the user.
I will come soon with a series about the Reasons and why we should use the MVC design pattern ?
More about MVC with the help of a diagram
What is Model : The Model represents your business logic . for eg : The model classes will contain functions that help you retrieve, insert, update information in your database, Also the main backbone logics were integrated inside the model.
What is View: The View is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer etc. ( can be invoked as required by the user ). For eg: The view will be different if
user request from normal pc or from a mobile and other devices.
What is Controller : The Controller serves as an intermediary between the Model and the View, and any other resources needed to process the HTTP request and generate a web page. More precisely Controller mainly handiles all validations and website work flow decision making.
Note : In CodeIgniter Framework, it has a fairly loose approach to MVC, bcoz it is not forces to use Models. If you don't need the built in separation, or find that maintaining models requires more complexity, you can ignore them and build your application minimally using Controllers and Views.
From the given Figure: can see Controller handling each and every request from user/browser and send it to Model for data processing and model again communicate back with the result to the Controller, finally the Controller rendering the results into a View and the view should be loaded for the user as a results of his request.
Guyz...hope you are happy with the session ....for any doubts you can contact me..
I will come up with the next one very soon...
- Attachments
-

- MVC web page work flow from server to client
- MVC.JPG (18.37 KiB) Viewed 7045 times