Chapter 28. Zend_Layout

Table of Contents

28.1. Introduction
28.2. Zend_Layout Quick Start
28.2.1. Layout scripts
28.2.2. Using Zend_Layout with the Zend Framework MVC
28.2.3. Using Zend_Layout as a Standalone Component
28.2.4. Sample Layout
28.3. Zend_Layout Configuration Options
28.3.1. Examples
28.4. Zend_Layout Advanced Usage
28.4.1. Custom View Objects
28.4.2. Custom Front Controller Plugins
28.4.3. Custom Action Helpers
28.4.4. Custom Layout Script Path Resolution: Using the Inflector

28.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.