Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^224) CHAPTER 15 ■ INTRODUCTION TO THE ZEND FRAMEWORK
The next step is to create the view for this information, as shown in Listing 15-8. Note that
you will need to create a new directory to contain the views for the customers controller.
Listing 15-8. Customers View (application/views/scripts/customers/index.phtml)










customers as $customer) { ?>






ID Name
customer_id; ?> name; ?>



Reloading the page should result in a stylish listing of the customers table.
You’re now up and running with the Zend Framework, but you have not handled any
input or done anything interactive yet.

Adding Functionality


The Zend Framework provides a set of functionality that is designed to make creating forms
and working with input data easier. This functionality consists of three main parts:


  • The request and response objects

  • Action helpers and view helpers


•Input validation

Using the Request and Response Objects.


The request object encapsulates all the HTTP data you could ever want to get your hands on,
including all GET (query), POST, and cookie data. It also provides information parsed from the
request URI, such as the controller and action names, as well as a special type of data called
parameters, which can be set from the URL to make your sites more search engine-friendly
than using query variables. Complementing the request object, the response object provides
an encapsulated way to work with the output stream.

McArthur_819-9C15.fm Page 224 Thursday, February 28, 2008 7:44 AM

Free download pdf