One of the most popular design patterns on Php is the Model-View-Controller (MVC). Many Php frameworks use this pattern as a way to separate the presentation from the data layer and keep things loosely coupled.
The Zend Framework comes with its own implementation of the MVC pattern. If you are not familiar with it, please read this getting started guide.
The first step is to create a new Zend MVC project:

This project wizard will create the basic skeleton for an MVC project:

The code is split into two main folders, application and html.
Inside html you have the index.php entry point. Here you should also put your images and other resources.
In the application folder you have your MVC code. In this sample, there is no data access code so you only have the controllers and views.
There are two controllers, one called IndexController that you can use to get started. And the ErrorController that is available to display error pages.
In this sample project IndexController class calls the welcome.phtml view when accessed.
Just hit F5 and you will see Zend Framework MVC in action working straight out of the box!
I hope this project type can help you get started using MVC which makes your application code less tightly coupled and easier to maintain.
Download VS.Php 2.5 Beta here:
http://www.jcxsoftware.com/jcx/vsphp/beta
- webmaster's blog
- Login or register to post comments














