Chapter 26. Zend_Layout

Table of Contents

26.1. Introduction
26.2. Zend_Layout Quick Start
26.2.1. Layout scripts
26.2.2. Using Zend_Layout with the Zend Framework MVC
26.2.3. Using Zend_Layout as a Standalone Component
26.2.4. Sample Layout
26.3. Zend_Layout Configuration Options
26.3.1. Examples
26.4. Zend_Layout Advanced Usage
26.4.1. Custom View Objects
26.4.2. Custom Front Controller Plugins
26.4.3. Custom Action Helpers
26.4.4. Custom Layout Script Path Resolution: Using the Inflector

26.1. Introduction

Zend_Layout implements a classic Two Step View pattern, allowing developers to wrap application content within another view, usually representing the site template. Such templates are often termed layouts by other projects, and Zend Framework has adopted this term for consistency.

The main goals of Zend_Layout are as follows:

  • Automate selection and rendering of layouts when used with the Zend Framework MVC components.

  • Provide separate scope for layout related variables and content.

  • Allow configuration, including layout name, layout script resolution (inflection), and layout script path.

  • Allow disabling layouts, changing layout scripts, and other states; allow these actions from within action controllers and view scripts.

  • Follow same script resolution rules (inflection) as the ViewRenderer, but allow them to also use different rules.

  • Allow usage without Zend Framework MVC components.