Hi, in this article i will mention about the topic MVC that used in Zend Framework.
I think, most of you have heard about the term MVC. So, what is this MVC? MVC stands for Model-View-Controller and it creates the basic substructure of current modern web applications. Let’s look at the below diagram;
Model: The functional structure of applications are located here. This functional structure is always behind a abstract system. In other words, this part is where the business logic is located in.
View: The data is represented to the user in this part. In general, Controller assigns data to View and View shows data to user. You can see HTML data structure here.
Controller: Controller acts like a bridge among the whole structure. Controllers manipulates the Models and it decides on which data goes which View. I want to advice you something;
The less code you used in Controller, the better. So, minify your code in Controller!
We talked about MVC theoritically above, let’s talk about what do all stuffs above equals to in Zend world. As you remember, we have created a project previous article and the folder structure was like below;
We can say following things by looking at the folder structure. In this project there is a Controller called Index. This controller manipulates some models that exist under models(I assumedd that or models are under models folder) folder. Controller does some operations by using datas that fetched from models and assigns the output to the View. If you go to following
url;
you will execute above scenario. As you can see, there is a view file under “application/views/scripts”. For example, there is a view folder called “index” for Index Controller.for each Controller . We use index controller and index action above so, index.phtml will be displayed under index folder.
There are lots of things to talk about Zend MVC but i tried to mention about basic points. I will be mention about Zend MVC in following articles partially. Please do not hesitate to ask here about this topic.
See you in next article…