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 license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Layout
- Version
- $Id$
\Zend_Layout
Package: Zend_Layout















Details
Returns



Returns




Returns







Provide Layout support for MVC applications
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

\Zend_View_Helper_Placeholder_Container $_containerPlaceholder container for layout variables
Details

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

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

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

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

string $_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'Plugin class
Default value
'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.
Parameters| Name | Type | Description |
|---|---|---|
| $options | string | array | \Zend_Config | |
| $initMvc |

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

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

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

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

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

assign(mixed $spec, mixed $value = null) : \Zend_LayoutAssign one or more layout variables
Parameters
Returns
Throws
| 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
Returns
| Type | Description |
|---|---|
| \Zend_Filter_Inflector |

getMvcInstance() : \Zend_Layout | nullstatic
Retrieve MVC instance of Zend_Layout object
Returns
| Type | Description |
|---|---|
| \Zend_Layout | null |

getView() : \Zend_View_InterfaceGet current view object
If no view object currently set, retrieves it from the ViewRenderer.
Returns| 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'.
Parameters| Name | Type | Description |
|---|---|---|
| $name | mixed |
| Type | Description |
|---|---|
| mixed |

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

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

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

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

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

setInflectorTarget(string $inflectorTarget) : \Zend_LayoutSet inflector target
Parameters
Returns
| 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
Parameters| Name | Type | Description |
|---|---|---|
| $name | string | |
| $enabled | boolean |
| Type | Description |
|---|---|
| \Zend_Layout |

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

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

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

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

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

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

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