Table of Contents – Zend Framework in Action

Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Preface

Acknowledgments

About this book

About the cover illustration

1. The essentials

Chapter 1. Introducing Zend Framework

1.1. Introducing Structure to PHP Websites

1.2. Why Use Zend Framework?

1.2.1. Everything is in the Box

1.2.2. Modern Design

1.2.3. Easy to Learn

1.2.4. Full Documentation

1.2.5. Simple Development

1.2.6. Rapid Development

1.2.7. Structured Code is Easy to Maintain

1.3. What is Zend Framework?

1.3.1. Where did it Come From?

1.3.2. What’s in it?

1.4. Zend Framework Design Philosophy

1.4.1. High-quality Components

1.4.2. Pragmatism and Flexibility

1.4.3. Clean IP

1.4.4. Support from Zend Technologies

1.5. Alternative PHP Frameworks

1.6. Summary

Chapter 2. Hello Zend Framework!

2.1. The Model-View-Controller Design Pattern

2.1.1. The Model

2.1.2. The View

2.1.3. The Controller

2.2. The Anatomy of a Zend Framework Application

2.2.1. The Application Directory

2.2.2. The Library Directory

2.2.3. The Tests Directory

2.2.4. The Public Directory

2.3. Hello World: File by File

2.3.1. Bootstrapping

2.3.2. Apache .htaccess

2.3.3. Index Controller

2.3.4. View Template

2.4. How MVC Applies to Zend Framework

2.4.1. Zend Framework’s Controller

2.4.2. Understanding Zend_View

2.4.3. The Model in MVC

2.5. Summary

2. A Core Application

Chapter 3. Building a website with Zend Framework

3.1. Initial Planning of a Website

3.1.1. The Site’s Goals

3.1.2. Designing the User Interface

3.1.3. Planning the Code

3.2. Initial Coding

3.2.1. The Directory Structure

3.2.2. The Bootstrap Class

3.2.3. Running the Application

3.3. The Home Page

3.3.1. The Initial Models

3.3.2. Testing Our Models

3.3.3. The Home-Page Controller

3.4. Summary

Chapter 4. Managing the view

4.1. Introducing the Two Step View and Composite View Patterns

4.2. View Handling with Zend_Layout

4.3. Integrating Zend_Layout into Places

4.3.1. Setup

4.3.2. Layout Scripts

4.3.3. Common Actions Using Placeholders

4.3.4. The Homepage View Script

4.4. Advanced View Helpers

4.4.1. Controller Integration

4.4.2. View Script Management

4.4.3. HTML Header Helpers

4.5. Summary

Chapter 5. Ajax

5.1. Introducing Ajax

5.1.1. Defining Ajax

5.1.2. Using Ajax in Web Applications

5.2. A simple Ajax Example

5.3. Using Ajax Client Libraries

5.4. Using Ajax with Zend Framework

5.4.1. The Controller

5.4.2. The View

5.5. Integrating into a Zend Framework Application

5.5.1. The Place Controller

5.5.2. Adding Review Rating HTML to the View Script

5.5.3. Adding JavaScript to the View Scripts

5.5.4. The Server Code

5.6. Summary

Chapter 6. Managing the database

6.1. Database Abstraction with Zend_Db_Adapter

6.1.1. Creating a Zend_Db_Adapter

6.1.2. Querying the Database

6.1.3. Inserting, Updating, and Deleting

6.1.4. Handling Database-Specific Differences

6.2. Table Abstraction with Zend_Db_Table

6.2.1. What is the Table Data Gateway Pattern?

6.2.2. Using Zend_Db_Table

6.2.3. Inserting and Updating with Zend_Db_Table

6.2.4. Deleting Records with Zend_Db_Table

6.3. Using Zend_Db_Table as a Model

6.3.1. Testing the Model

6.3.2. Table Relationships with Zend_Db_Table

6.4. Summary

Chapter 7. User authentication and access control

7.1. Introducing Authentication and Access Control

7.1.1. What is Authentication?

7.1.2. What is Access Control?

7.2. Implementing Authentication

7.2.1. Introducing Zend_Auth

7.2.2. Logging in Using HTTP Authentication

7.3. Using Zend_Auth in a Real Application

7.3.1. Logging in

7.3.2. A View Helper Welcome Message

7.3.3. Logging out

7.4. Implementing Access Control

7.4.1. Introducing Zend_Acl

7.4.2. Configuring a Zend_Acl Object

7.4.3. Checking the Zend_Acl Object

7.5. Summary

Chapter 8. Forms

8.1. Introducing Zend_Form

8.1.1. Integrated Data Filters and Validators

8.1.2. Integrated Error Handling

8.1.3. Decorators to Simplify Markup

8.1.4. Plug-in Loaders for Customization

8.1.5. Internationalization

8.1.6. Subforms and Display Groups

8.2. Building a Login Form

8.2.1. Setting up Paths

8.2.2. Our form View Script

8.2.3. Updating the AuthController Controller Action

8.2.4. The Basic Login form Class

8.3. Filtering and Validation

8.3.1. Basic Filtering and Validation

8.3.2. Custom Error Messages

8.3.3. Internationalizing the Form

8.3.4. Adding a Custom Validator

8.4. Decorating Our Login Form

8.4.1. Zend_Form Default Decorators

8.4.2. Setting Our Own Decorators

8.5. Summary

Chapter 9. Searching

9.1. Benefits of Search

9.1.1. Key Usability Issue for Users

9.1.2. Ranking Results is Important

9.2. Introducing Zend_Search_Lucene

9.2.1. Creating a Separate Search Index for your Website

9.2.2. Powerful Queries

9.2.3. Best Practices

9.3. Adding Search to Places

9.3.1. Updating the Index as new Content is Added

9.3.2. Creating the Search form and Displaying the Results

9.4. Summary

Chapter 10. Email

10.1. The Basics of Email

10.1.1. Email Simplified

10.1.2. Dissecting an Email Address

10.2. Introducing Zend_Mail

10.2.1. Creating Emails with Zend_Mail

10.2.2. Sending Emails with Zend_Mail

10.3. Building a Support Tracker for Places

10.3.1. Designing the Application

10.3.2. Integrating Zend_Mail into the Application

10.3.3. Adding Headers to the Support Email

10.3.4. Adding Attachments to the Support Email

10.3.5. Formatting the email

10.4. Reading Email

10.4.1. Collecting and Storing Email

10.4.2. Reading Email with Our Application

10.5. Summary

Chapter 11. Deployment

11.1. Setting up the Server

11.1.1. Designing for Different Environments

11.1.2. Using Virtual Hosts for Development

11.2. Version Control with Subversion

11.2.1. Creating the Subversion Repository

11.2.2. Checking out Code from the Repository

11.2.3. Committing Changes to the Repository

11.2.4. Updating a Local Working Copy

11.2.5. Dealing with Conflicts

11.2.6. Getting a Clean Copy from the Repository

11.2.7. Using Branches

11.2.8. Externals

11.3. Functional Testing

11.3.1. Functional Testing with Selenium IDE

11.3.2. Automating Selenium IDE Tests

11.3.3. Functional Testing with Zend_Http_Client

11.4. Scripting the deployment

11.5. Summary

3. More Power to Your Application

Chapter 12. Talking with other applications

12.1. Integrating Applications

12.1.1. Exchanging Structured Data

12.1.2. Producing and Consuming Structured Data

12.1.3. How Web Services Work

12.1.4. Why We Need Web Services

12.2. Producing and Consuming Feeds with Zend_Feed

12.2.1. Producing a Feed

12.2.2. Consuming a Feed

12.3. Making RPCs with Zend_XmlRpc

12.3.1. Using Zend_XmlRpc_Server

12.3.2. Using Zend_XmlRpc_Client

12.4. Using REST Web Services with Zend_Rest

12.4.1. What is REST?

12.4.2. Using Zend_Rest_Client

12.4.3. Using Zend_Rest_Server

12.5. Summary

Chapter 13. Mashups with public web services

13.1. Accessing Public Web Services

13.1.1. Zend_Gdata

13.1.2. Zend_Service_Akismet

13.1.3. Zend_Service_Amazon

13.1.4. Zend_Service_Audioscrobbler

13.1.5. Zend_Service_Delicious

13.1.6. Zend_Service_Flickr

13.1.7. Zend_Service_Gravatar

13.1.8. Zend_Service_Nirvanix

13.1.9. Zend_Service_RememberTheMilk

13.1.10. Zend_Service_Simpy

13.1.11. Zend_Service_SlideShare

13.1.12. Zend_Service_StrikeIron

13.1.13. Zend_Service_Technorati

13.1.14. Zend_Service_Yahoo

13.2. Displaying ads with Amazon Web Services

13.2.1. The Amazon Model Class

13.2.2. The Amazon ads View Helper

13.2.3. Caching the View Helper

13.3. Displaying Pictures from Flickr

13.3.1. The Flickr Model Class

13.3.2. Using Flickr in an Action Controller

13.4. Using Zend_Gdata for Google Access

13.4.1. The YouTube API in an Action Controller

13.4.2. The Video Categories Page

13.4.3. The Video List Page

13.4.4. The Video Page

13.5. Summary

Chapter 14. Caching: making it faster

14.1. Benefits of Caching

14.2. How Caching Works

14.3. Implementing Zend_Cache

14.3.1. Zend_Cache Frontends

14.3.2. Zend_Cache Backends

14.4. Caching at Different Application Levels

14.4.1. Choosing What to Cache

14.4.2. Optimal Cache Expiry

14.5. Cache Tags

14.6. Summary

Chapter 15. Internationalization and localization

15.1. Translating Languages and Idioms

15.1.1. Translating Languages

15.1.2. Translating Idioms

15.2. Using Zend_Locale and Zend_Translate

15.2.1. Setting the Locale with Zend_Locale

15.2.2. Translating with Zend_Translate

15.3. Adding a Second Language to the Places Application

15.3.1. Selecting the Language

15.3.2. The LanguageSetup Front Controller Plug-in

15.3.3. Translating the View

15.3.4. Displaying the Correct Date with Zend_Locale

15.4. Summary

Chapter 16. Creating PDFs

16.1. Zend_Pdf Basics

16.1.1. Creating or Loading Documents

16.1.2. Creating Pages in Your PDF Document

16.1.3. Adding Document Meta-Information

16.1.4. Saving the PDF Document

16.2. Building a PDF Report Generator

16.2.1. Our Report Document Model

16.2.2. Our Report Page Model

16.3. Drawing Text on the Page

16.3.1. Choosing Fonts

16.3.2. Setting the Font and Adding Text

16.3.3. Adding Wrapped Text

16.4. Working with Color

16.4.1. Choosing Colors

16.4.2. Setting Colors

16.5. Using Styles

16.6. Drawing Shapes

16.6.1. Drawing Lines

16.6.2. Setting up Dashed Lines

16.6.3. Drawing Rectangles and Polygons

16.6.4. Drawing Circles and Ellipses

16.7. Rotating Objects

16.8. Adding Images to the Page

16.9. Drawing Objects within Clipping Masks

16.10. Generating PDF Reports

16.11. Summary

Appendix A. A whistle-Stop Tour of PHP Syntax

A.1. PHP Fundamentals

A.2. Variables and Types

A.2.1. Strings

A.2.2. Arrays

A.3. Conditionals and Loops

A.3.1. Conditionals

A.3.2. Looping

A.3.3. Alternative Syntax for the Nested Block

A.4. Functions

A.5. Summary

Appendix B. Object-Oriented PHP

B.1. Object Orientation in PHP

B.1.1. Classes, Objects, and Inheritance

B.1.2. Extending Classes

B.1.3. Abstract Classes and Interfaces

B.1.4. Magic Methods

B.2. The SPL

B.2.1. Using Iterators

B.2.2. Using ArrayAccess and Countable

B.3. PHP4

B.4. Software Design Patterns

B.4.1. The Singleton Pattern

B.4.2. The Registry pattern

B.5. Summary

Appendix C. Tips and tricks

C.1 MVC Tips and Tricks

C.1.1 Modules

C.1.2 Case Sensitivity

Word Separation within Action URLs

C.1.3 Routing

C.2 Diagnostics with Zend_Log and Zend_Debug

C.2.1 Zend_Debug

C.2.2 Zend_Log

C.3 Zend_Db_Profiler

C.4 Summary

Index

List of Figures

List of Tables

List of Listings