Layout.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Layout
- Version
- $Id: Layout.php 25263 2013-02-18 11:48:02Z frosch $
\Zend_Layout
Provide Layout support for MVC applications
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

\Zend_View_Helper_Placeholder_Container $_container = Placeholder container for layout variables

string $_contentKey = 'content'Key used to store content from 'default' named response segment
'content'Details- Type
- string

string $_helperClass = 'Zend_Layout_Controller_Action_Helper_Layout'Helper class
'Zend_Layout_Controller_Action_Helper_Layout'Details- Type
- string

string $_inflectorTarget = ':script.:suffix'Inflector target
':script.:suffix'Details- Type
- string

bool $_mvcSuccessfulActionOnly = trueFlag: is MVC successful action only flag set?
trueDetails- Type
- bool

string $_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'Plugin class
'Zend_Layout_Controller_Plugin_Layout'Details- Type
- string
Methods

__construct(string | array | \Zend_Config $options = null, $initMvc = false) : voidConstructor
Accepts either: - A string path to layouts - An array of options - A Zend_Config object with options
Layout script path, either as argument or as key in options, is required.
If mvcEnabled flag is false from options, simply sets layout script path. Otherwise, also instantiates and registers action helper and controller plugin.
| Name | Type | Description |
|---|---|---|
| $options | string | array | \Zend_Config | |
| $initMvc |

__get(string $key) : mixedGet layout variable
| Name | Type | Description |
|---|---|---|
| $key | string |
| Type | Description |
|---|---|
| mixed |

__isset(string $key) : boolIs a layout variable set?
| Name | Type | Description |
|---|---|---|
| $key | string |
| Type | Description |
|---|---|
| bool |

__set(string $key, mixed $value) : voidSet layout variable
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |

_initVarContainer() : \Zend_View_Helper_Placeholder_ContainerInitialize placeholder container for layout vars
| Type | Description |
|---|---|
| \Zend_View_Helper_Placeholder_Container |

_setMvcEnabled(bool $mvcEnabled) : \Zend_LayoutSet MVC enabled flag
| Name | Type | Description |
|---|---|---|
| $mvcEnabled | bool |
| Type | Description |
|---|---|
| \Zend_Layout |

assign(mixed $spec, mixed $value = null) : \Zend_LayoutAssign one or more layout variables
| Name | Type | Description |
|---|---|---|
| $spec | mixed | Assoc array or string key; if assoc array, sets each key as a layout variable |
| $value | mixed | Value if $spec is a key |
| Type | Description |
|---|---|
| \Zend_Layout |
| Exception | Description |
|---|---|
| \Zend_Layout_Exception | if non-array/string value passed to $spec |

getInflector() : \Zend_Filter_InflectorRetrieve inflector
| Type | Description |
|---|---|
| \Zend_Filter_Inflector |

getMvcInstance() : \Zend_Layout | nullRetrieve MVC instance of Zend_Layout object
| Type | Description |
|---|---|
| \Zend_Layout | null |

getMvcSuccessfulActionOnly() : boolGet MVC Successful Action Only Flag
| Type | Description |
|---|---|
| bool |

getView() : \Zend_View_InterfaceGet current view object
If no view object currently set, retrieves it from the ViewRenderer.
| Type | Description |
|---|---|
| \Zend_View_Interface |
- Todo
- Set inflector from view renderer at same time

render(mixed $name = null) : mixedRender layout
Sets internal script path as last path on script path stack, assigns layout variables to view, determines layout name using inflector, and renders layout view script.
$name will be passed to the inflector as the key 'script'.
| Name | Type | Description |
|---|---|---|
| $name | mixed |
| Type | Description |
|---|---|
| mixed |

resetMvcInstance() : voidReset MVC instance
Unregisters plugins and helpers, and destroys MVC layout instance.

setConfig(\Zend_Config $config) : \Zend_LayoutSet options from a config object
| Name | Type | Description |
|---|---|---|
| $config | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Layout |

setContentKey(string $contentKey) : \Zend_LayoutSet content key
Key in namespace container denoting default content
| Name | Type | Description |
|---|---|---|
| $contentKey | string |
| Type | Description |
|---|---|
| \Zend_Layout |

setHelperClass(string $helperClass) : \Zend_LayoutSet helper class
| Name | Type | Description |
|---|---|---|
| $helperClass | string |
| Type | Description |
|---|---|
| \Zend_Layout |

setInflector(\Zend_Filter_Inflector $inflector) : \Zend_LayoutSet inflector to use when resolving layout names
| Name | Type | Description |
|---|---|---|
| $inflector | \Zend_Filter_Inflector |
| Type | Description |
|---|---|
| \Zend_Layout |

setInflectorTarget(string $inflectorTarget) : \Zend_LayoutSet inflector target
| Name | Type | Description |
|---|---|---|
| $inflectorTarget | string |
| Type | Description |
|---|---|
| \Zend_Layout |

setLayout(string $name, boolean $enabled = true) : \Zend_LayoutSet layout script to use
Note: enables layout by default, can be disabled
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $enabled | boolean |
| Type | Description |
|---|---|
| \Zend_Layout |

setLayoutPath(string $path) : \Zend_LayoutSet layout script path
| Name | Type | Description |
|---|---|---|
| $path | string |
| Type | Description |
|---|---|
| \Zend_Layout |

setMvcSuccessfulActionOnly(bool $successfulActionOnly) : \Zend_LayoutSet MVC Successful Action Only flag
| Name | Type | Description |
|---|---|---|
| $successfulActionOnly | bool |
| Type | Description |
|---|---|
| \Zend_Layout |

setOptions(array | \Zend_Config $options) : voidSet options en masse
| Name | Type | Description |
|---|---|---|
| $options | array | \Zend_Config |

setPluginClass(string $pluginClass) : \Zend_LayoutSet plugin class
| Name | Type | Description |
|---|---|---|
| $pluginClass | string |
| Type | Description |
|---|---|
| \Zend_Layout |

setView(\Zend_View_Interface $view) : \Zend_LayoutSet view object
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_Layout |

setViewBasePath( $path, $prefix = 'Layout_View') : void| Name | Type | Description |
|---|---|---|
| $path | ||
| $prefix |

setViewSuffix(string $viewSuffix) : \Zend_LayoutSet layout view script suffix
| Name | Type | Description |
|---|---|---|
| $viewSuffix | string |
| Type | Description |
|---|---|
| \Zend_Layout |

startMvc(string | array | \Zend_Config $options = null) : \Zend_LayoutStatic method for initialization with MVC support
| Name | Type | Description |
|---|---|---|
| $options | string | array | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Layout |