In this third part of a four-part series on MVC and the Zend framework, you'll start building your first website based on the Zend framework and the model-view-controller pattern. This article is excerpted from chapter 25 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).
Creating Your First Zend Framework-Driven Web Site
Its a fair bet that even a very simple example will leave you utterly convinced that frameworks are a development tool you won't be able to live without.
Create the Directory Structure
By default, the Zend Framework relies upon a highly organized application directory structure known as the conventional modular directory structure. In its most basic form, this structure looks like this:
Web server document root/ index.php application/ modules/ default/ controllers/ views/ scripts/
This structure opens up the possibility to manage multiple hosted MVC applications within the same location. In a situation where multiple MVC applications exist, you would add additional module directories under the modules directory. However, for the purposes of the examples in this chapter, we'll just stick with a single (default) application.
Therefore, a simple Web application might be structured as follows. Note how there are three controllers and each of those controllers matches up to a corresponding view directory:
Don't worry about the oddly named files and structure too much at this point. Just understand that based on the provided controllers and views and a typical configuration, the following URLs would work: