Chapter 2. Hello Zend Framework!

 

This chapter covers

  • An introduction to the Model-View-Controller design pattern
  • Zend Framework’s controller components
  • The Zend_View component
  • Databases as models

Before we can investigate in detail all the components of Zend Framework, we must get our bearings, and this is best done by building a simple website that uses the MVC) components. For a standard PHP application, the code to display the text “Hello World” constitutes just one line in one file:

<?php echo 'Hello World';

In this chapter, we will build a Hello World application using Zend Framework. We will also consider how to organize the website’s files on disk to make sure we can find what we are looking for, and we will look at Zend Framework files required to create an application that uses the MVC design pattern.

Note

Zend Framework requires many files to create the foundation from which a full website can be created. This means the code for our Hello World application may appear unnecessarily verbose as we set the stage for the full-blown website that will follow in later chapters.

This chapter will walk through all the files required to build Hello World. We will also discuss Zend Framework’s MVC design and the core components it provides for building the controller, view, and model in our application. Let’s dive right in and look at what the Model-View-Controller design pattern is all about.

2.1. The Model-View-Controller Design Pattern

2.2. The Anatomy of a Zend Framework Application

2.3. Hello World: File by File

2.4. How MVC Applies to Zend Framework

2.5. Summary