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 $_container
Placeholder 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 = true
Flag: is MVC successful action only flag set?
Default value
true
Details- 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) : void
Constructor
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.
ParametersName | Type | Description |
---|---|---|
$options | string | array | \Zend_Config | |
$initMvc |


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


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


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


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


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


assign(mixed $spec, mixed $value = null) : \Zend_Layout
Assign 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_Inflector
Retrieve inflector
Returns
Type | Description |
---|---|
\Zend_Filter_Inflector |


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


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


render(mixed $name = null) : mixed
Render 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'.
ParametersName | Type | Description |
---|---|---|
$name | mixed |
Type | Description |
---|---|
mixed |


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


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


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


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


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


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


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


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


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


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


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


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


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


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