You are previewing Pro Zend Framework Techniques: Build a Full CMS Project.
O'Reilly logo
Pro Zend Framework Techniques: Build a Full CMS Project

Book Description

One of the most common uses for a framework such as this is to build content-driven web sites. Pro Zend Framework CMS provides a clear guide to building a custom CMS with the Zend Framework, showing how to utilize the many different aspects of the framework as part of the process.

Table of Contents

  1. Copyright
  2. Preface
  3. About the Author
  4. About the Technical Reviewers
  5. Acknowledgments
  6. Introduction
    1. Who This Book Is For
      1. Prerequisites
  7. 1. Getting Started
    1. 1.1. Introducing Zend Framework MVC Implementation
      1. 1.1.1. The Controller: Zend_Controller_Front
      2. 1.1.2. The Model: Zend_Db
      3. 1.1.3. The View: Zend_View
    2. 1.2. Setting Up Your Development Environment
      1. 1.2.1. Installing Zend Server CE
      2. 1.2.2. Doing Rapid Application Development with the Zend Command-Line Tool
    3. 1.3. Creating Your Project
      1. 1.3.1. Building a Project with the Zend Tool Framework
      2. 1.3.2. Testing Your New Project
    4. 1.4. Exploring the Anatomy of Your Project
      1. 1.4.1. The public Folder
        1. 1.4.1.1. Redirecting the Request with .htaccess
        2. 1.4.1.2. The Index File
        3. 1.4.1.3. Additional Public Folders
      2. 1.4.2. The library Folder
      3. 1.4.3. The application Folder
        1. 1.4.3.1. Zend_Application
        2. 1.4.3.2. The Bootstrap Class
        3. 1.4.3.3. Application Configuration
        4. 1.4.3.4. Action Controllers
        5. 1.4.3.5. Views
        6. 1.4.3.6. Error Handling
    5. 1.5. Summary
  8. 2. Designing Your Site
    1. 2.1. Rendering the Presentation Layer with Zend_View
      1. 2.1.1. View Scripts
      2. 2.1.2. View Helpers
    2. 2.2. Rendering the Presentation Layer with Zend_Layout
      1. 2.2.1. Using Zend_Layout on Its Own
      2. 2.2.2. Zend_Layout MVC
    3. 2.3. Three-Step Views
    4. 2.4. Designing the Interface
      1. 2.4.1. Organizing the Interface Components
      2. 2.4.2. Mocking It Up
      3. 2.4.3. Creating the Base HTML Page
      4. 2.4.4. Testing Your Design
    5. 2.5. Creating the Layout
      1. 2.5.1. Creating the Layout
      2. 2.5.2. Adding the Dynamic Head with Zend_View's Placeholders
      3. 2.5.3. Adding the Dynamic Content to Your Layout
      4. 2.5.4. Rendering the Controller Response with Zend_Layout
      5. 2.5.5. Configuring Your Application to Use the Layout
      6. 2.5.6. Testing Your New Layout
    6. 2.6. Implementing the Skin
      1. 2.6.1. What Goes in a Skin?
      2. 2.6.2. Creating the Blues Skin
        1. 2.6.2.1. The skin.xml File
        2. 2.6.2.2. The Style Sheets
      3. 2.6.3. Building a View Helper to Render the Skin
      4. 2.6.4. Using the loadSkin Helper
      5. 2.6.5. Testing the Skin
    7. 2.7. Summary
  9. 3. Building and Processing Web Forms with Zend_Form
    1. 3.1. The Anatomy of a Zend Framework Form
      1. 3.1.1. Rendering Forms
      2. 3.1.2. Processing a Form
    2. 3.2. Form Elements
      1. 3.2.1. Initial Elements
        1. 3.2.1.1. Zend_Form_Element_Button
        2. 3.2.1.2. Zend_Form_Element_Captcha
        3. 3.2.1.3. Zend_Form_Element_Checkbox
        4. 3.2.1.4. Zend_Form_Element_File
        5. 3.2.1.5. Zend_Form_Element_Hidden
        6. 3.2.1.6. Zend_Form_Element_Hash
        7. 3.2.1.7. Zend_Form_Element_Image
        8. 3.2.1.8. Zend_Form_Element_MultiCheckbox
        9. 3.2.1.9. Zend_Form_Element_Multiselect
        10. 3.2.1.10. Zend_Form_Element_Password
        11. 3.2.1.11. Zend_Form_Element_Radio
        12. 3.2.1.12. Zend_Form_Element_Reset
        13. 3.2.1.13. Zend_Form_Element_Select
        14. 3.2.1.14. Zend_Form_Element_Submit
        15. 3.2.1.15. Zend_Form_Element_Text
        16. 3.2.1.16. Zend_Form_Element_Textarea
      2. 3.2.2. Custom Form Elements
    3. 3.3. Creating a Page Form
      1. 3.3.1. Getting Started
      2. 3.3.2. Creating the Form
      3. 3.3.3. Adding Controls to the Form
        1. 3.3.3.1. The Author Text Control
        2. 3.3.3.2. The E-mail Text Control
        3. 3.3.3.3. The Date Text Control
        4. 3.3.3.4. The URL Text Control
        5. 3.3.3.5. The Description Text Area Control
        6. 3.3.3.6. The Priority Select Control
        7. 3.3.3.7. The Status Select Control
        8. 3.3.3.8. The Submit Button
      4. 3.3.4. Rendering the Form
      5. 3.3.5. Processing the Form
      6. 3.3.6. Styling the Form
    4. 3.4. Summary
  10. 4. Managing Data with Zend Framework
    1. 4.1. Setting Up the Database
      1. 4.1.1. Creating the CMS Database
      2. 4.1.2. Configuring the Database Connection
      3. 4.1.3. Creating the bugs Table
    2. 4.2. Exploring the Zend Framework Models
      1. 4.2.1. Learning About the Models
      2. 4.2.2. Creating the Bug Model
    3. 4.3. Working with Bugs
      1. 4.3.1. Submitting a New Bug
        1. 4.3.1.1. Creating the createBug() Method
        2. 4.3.1.2. Updating the Bug Controller's Submit Action
      2. 4.3.2. Viewing All the Current Bugs
        1. 4.3.2.1. Creating the fetchBugs() Method
        2. 4.3.2.2. Adding the List Action to the Bug Controller
        3. 4.3.2.3. Creating the List View
      3. 4.3.3. Filtering and Sorting the Bug Reports
        1. 4.3.3.1. Updating the fetchBugs() Method
        2. 4.3.3.2. Creating the Form to Filter and Sort the Bugs
        3. 4.3.3.3. Loading and Rendering the Filter Form
        4. 4.3.3.4. Processing the Filters and Sort Criteria
      4. 4.3.4. Limiting and Paginating Bug Reports Using Zend_Paginator
        1. 4.3.4.1. Updating the fetchBugs() Method to Return a Zend_Paginator Adapter
        2. 4.3.4.2. Refactoring the Bug Controller listAction() to Load the Paginator
        3. 4.3.4.3. Rendering the Bug Reports Using the Paginator
      5. 4.3.5. Updating a Bug
        1. 4.3.5.1. Updating the Bug Report Form
        2. 4.3.5.2. Creating the Edit Action
        3. 4.3.5.3. Creating the Edit View
        4. 4.3.5.4. Updating the Bug Record
      6. 4.3.6. Deleting a Bug
        1. 4.3.6.1. Adding the Delete Method to the Bug Model
        2. 4.3.6.2. Creating the Bug Controller Delete Action
    4. 4.4. Summary
  11. 5. Working with CMS Data
    1. 5.1. Exploring the Data Structure
      1. 5.1.1. Traditional CMS Data Structures
      2. 5.1.2. Abstract Data Structures
    2. 5.2. Designing a Database That Can Grow with Your System
    3. 5.3. Implementing the Data Management System
    4. 5.4. Managing Content Nodes
      1. 5.4.1. Creating the content_nodes Table
      2. 5.4.2. Creating the ContentNode Model Class
        1. 5.4.2.1. Creating and Updating Content Nodes
        2. 5.4.2.2. Deleting Nodes
    5. 5.5. Managing Pages
      1. 5.5.1. Creating the pages Table
      2. 5.5.2. Creating the Page Model Class
        1. 5.5.2.1. Creating Pages
        2. 5.5.2.2. Updating Existing Pages
        3. 5.5.2.3. Deleting a Page
    6. 5.6. Defining and Working with Table Relationships
      1. 5.6.1. Defining the Relationships
        1. 5.6.1.1. The ContentNode to Page Relationship
        2. 5.6.1.2. The Page to Parent Page Relationship
      2. 5.6.2. Working with Related Items
      3. 5.6.3. Cascading Updates and Deletes
    7. 5.7. Working with Content Items
      1. 5.7.1. Using the Abstract CMS Content_Item Class
        1. 5.7.1.1. Creating the Base Class
        2. 5.7.1.2. Loading Pages
        3. 5.7.1.3. Using Utility Methods
        4. 5.7.1.4. Manipulating Data
      2. 5.7.2. Extending the Base Content Item Class
    8. 5.8. Summary
  12. 6. Managing Content
    1. 6.1. Creating and Updating Content Pages
      1. 6.1.1. Creating the Page Content Item Class
      2. 6.1.2. Creating the Page Controller
      3. 6.1.3. Creating the Page Form
        1. 6.1.3.1. Rendering the Page Form
        2. 6.1.3.2. Inserting the New Page
      4. 6.1.4. Managing Pages
      5. 6.1.5. Editing an Existing Page
        1. 6.1.5.1. Opening a Page to Edit
        2. 6.1.5.2. Updating the Page
      6. 6.1.6. Deleting Pages
    2. 6.2. Rendering Pages
      1. 6.2.1. The Home Page
        1. 6.2.1.1. Rendering the Most Recent Pages
        2. 6.2.1.2. Setting This Page As Your Site's Home Page
      2. 6.2.2. Opening a Page
    3. 6.3. Summary
  13. 7. Creating the Site Navigation
    1. 7.1. How CMSs Manage Menus
    2. 7.2. Managing Menu Data
    3. 7.3. Creating the Menu Controllers
    4. 7.4. Creating a New Menu
      1. 7.4.1. Creating the Menu Form
      2. 7.4.2. Rendering the Create Menu Form
      3. 7.4.3. Processing the Form
    5. 7.5. Listing Current Menus
    6. 7.6. Updating a Menu
      1. 7.6.1. Opening the Menu to Edit
      2. 7.6.2. Updating the Menu
    7. 7.7. Deleting Menus
    8. 7.8. Managing Menu Items
      1. 7.8.1. Listing the Menu Items
      2. 7.8.2. Adding New Menu Items
        1. 7.8.2.1. The Menu Item Form
        2. 7.8.2.2. Creating the Add Menu Item Action
        3. 7.8.2.3. Rendering the Menu Item Form
        4. 7.8.2.4. Processing the Form
      3. 7.8.3. Sorting Menu Items
      4. 7.8.4. Updating Menu Items
        1. 7.8.4.1. Loading the Update Item Form
        2. 7.8.4.2. Rendering the Update Item Form
        3. 7.8.4.3. Processing the Update Item Form
      5. 7.8.5. Deleting Menu Items
    9. 7.9. Rendering Menus
    10. 7.10. Creating the Main Site Menus
      1. 7.10.1. Creating the Main Menus
      2. 7.10.2. Setting the Main Menu GUIDs
      3. 7.10.3. Rendering the Main Menus
      4. 7.10.4. Rendering the Admin Menu
    11. 7.11. Creating SEO-Friendly URLs
    12. 7.12. Summary
  14. 8. Handling Security in a Zend Framework Project
    1. 8.1. Managing CMS Users
      1. 8.1.1. User Data and Model
      2. 8.1.2. Creating a New User
        1. 8.1.2.1. Creating the User Controller
        2. 8.1.2.2. Creating the User Form
        3. 8.1.2.3. Rendering the Create User Form
        4. 8.1.2.4. Processing the Form
      3. 8.1.3. Managing Existing Users
      4. 8.1.4. Updating Users
      5. 8.1.5. Deleting Users
    2. 8.2. Authenticating Users with Zend_Auth
      1. 8.2.1. Creating the User Landing Page
      2. 8.2.2. Creating the User Login
      3. 8.2.3. Logging Users Out
      4. 8.2.4. Adding User Controls to the Main CMS Interface
    3. 8.3. Controlling Access with Zend_Acl
      1. 8.3.1. Using Zend_Acl
    4. 8.4. Securing Your CMS Project
    5. 8.5. Summary
  15. 9. Searching and Sharing Content
    1. 9.1. Working with the Lucene Search Engine
      1. 9.1.1. Creating a Search Index
      2. 9.1.2. Documents and Fields
    2. 9.2. Implementing Site Search
      1. 9.2.1. Securing Site Search
      2. 9.2.2. Creating the Search Index
        1. 9.2.2.1. The Build Action
        2. 9.2.2.2. The Build Search View
      3. 9.2.3. Searching the Site
        1. 9.2.3.1. The Search Form
        2. 9.2.3.2. Adding the Search Form to the Site
        3. 9.2.3.3. Processing a Search Request
        4. 9.2.3.4. Rendering Search Results
        5. 9.2.3.5. Testing Site Search
    3. 9.3. Working with Zend Feed
      1. 9.3.1. Creating the What's New Feed
      2. 9.3.2. Securing the Feeds
      3. 9.3.3. Building and Rendering the Feed
      4. 9.3.4. Adding the Feed to the Site
    4. 9.4. Web Services and Zend Framework
      1. 9.4.1. Working with Existing Services
      2. 9.4.2. Creating an API for your CMS with Zend REST
        1. 9.4.2.1. The Base Class
        2. 9.4.2.2. Securing the API
        3. 9.4.2.3. Searching Pages
        4. 9.4.2.4. Creating Pages
        5. 9.4.2.5. Updating Pages
        6. 9.4.2.6. Deleting Pages
      3. 9.4.3. Creating the API Server
      4. 9.4.4. Testing the API
        1. 9.4.4.1. Testing Searching
        2. 9.4.4.2. Testing Creating a Page
        3. 9.4.4.3. Updating the Page
        4. 9.4.4.4. Deleting the Page
    5. 9.5. Summary
  16. 10. Extending Your CMS
    1. 10.1. Creating the Module
    2. 10.2. Configuring Your Application to Load Modules
    3. 10.3. Rendering the Contact Form
    4. 10.4. Processing the Contact Form
    5. 10.5. Sending Mail with Zend_Mail
      1. 10.5.1. Creating the Mail Template
      2. 10.5.2. Rendering and Sending the HTML Message
      3. 10.5.3. The Confirmation Message
    6. 10.6. Securing the Form with Captcha
    7. 10.7. Using SMTP Mail Transport
    8. 10.8. File Attachments
      1. 10.8.1. Uploading the File
      2. 10.8.2. Attaching the File to Your Message
    9. 10.9. Summary
  17. 11. Advanced Topics
    1. 11.1. Performance Tuning
      1. 11.1.1. About Zend_Db_Profiler
      2. 11.1.2. Testing Your Application
        1. 11.1.2.1. Creating the Profiler View Script
        2. 11.1.2.2. Adding the Profiler Script to the Site
        3. 11.1.2.3. Optimizing the CMS_Content_Item_Page Class
    2. 11.2. Caching
      1. 11.2.1. Implementing Cache
        1. 11.2.1.1. Configuring the Cache
        2. 11.2.1.2. Creating the Cache Application Resource
      2. 11.2.2. Caching Menu Data
      3. 11.2.3. Updating the Cached Menus
      4. 11.2.4. Caching Content Items
    3. 11.3. Internationalization
      1. 11.3.1. Getting Started with Zend_Translate
      2. 11.3.2. Zend_Translate_Adapters
      3. 11.3.3. Integrating Zend_Translate with Your Project
    4. 11.4. Other Hidden Gems
    5. 11.5. Summary
  18. 12. Installing and Managing a Site with Your CMS
    1. 12.1. Creating the Database
    2. 12.2. Installing the Application
      1. 12.2.1. Alternate Installations
      2. 12.2.2. Sharing One Common Library
      3. 12.2.3. Configuring Your CMS
    3. 12.3. Managing Users
      1. 12.3.1. Creating a User
      2. 12.3.2. Updating a User
      3. 12.3.3. Deleting a User
    4. 12.4. Managing Content
      1. 12.4.1. Creating a Page
      2. 12.4.2. Updating a Page
      3. 12.4.3. Deleting a Page
    5. 12.5. Navigating Between Pages
      1. 12.5.1. Adding a Menu Item
      2. 12.5.2. Sorting Menu Items
      3. 12.5.3. Updating Menu Items
      4. 12.5.4. Deleting Menu Items
    6. 12.6. The Next Steps