Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Layout Class Reference

Public Member Functions

 __construct ($options=null, $initMvc=false)
 Constructor.
 
 setOptions ($options)
 Set options en masse.
 
 setConfig (Zend_Config $config)
 Set options from a config object.
 
 setLayout ($name, $enabled=true)
 Set layout script to use.
 
 getLayout ()
 Get current layout script.
 
 disableLayout ()
 Disable layout.
 
 enableLayout ()
 Enable layout.
 
 isEnabled ()
 Is layout enabled?
 
 setViewBasePath ($path, $prefix= 'Layout_View')
 
 getViewBasePath ()
 
 setViewScriptPath ($path)
 
 getViewScriptPath ()
 
 setLayoutPath ($path)
 Set layout script path.
 
 getLayoutPath ()
 Get current layout script path.
 
 setContentKey ($contentKey)
 Set content key.
 
 getContentKey ()
 Retrieve content key.
 
 getMvcEnabled ()
 Retrieve MVC enabled flag.
 
 setMvcSuccessfulActionOnly ($successfulActionOnly)
 Set MVC Successful Action Only flag.
 
 getMvcSuccessfulActionOnly ()
 Get MVC Successful Action Only Flag.
 
 setView (Zend_View_Interface $view)
 Set view object.
 
 getHelperClass ()
 Retrieve helper class.
 
 setHelperClass ($helperClass)
 Set helper class.
 
 getPluginClass ()
 Retrieve plugin class.
 
 setPluginClass ($pluginClass)
 Set plugin class.
 
 getView ()
 Get current view object.
 
 setViewSuffix ($viewSuffix)
 Set layout view script suffix.
 
 getViewSuffix ()
 Retrieve layout view script suffix.
 
 getInflectorTarget ()
 Retrieve inflector target.
 
 setInflectorTarget ($inflectorTarget)
 Set inflector target.
 
 setInflector (Zend_Filter_Inflector $inflector)
 Set inflector to use when resolving layout names.
 
 getInflector ()
 Retrieve inflector.
 
 enableInflector ()
 Enable inflector.
 
 disableInflector ()
 Disable inflector.
 
 inflectorEnabled ()
 Return status of inflector enabled flag.
 
 __set ($key, $value)
 Set layout variable.
 
 __get ($key)
 Get layout variable.
 
 __isset ($key)
 Is a layout variable set?
 
 __unset ($key)
 Unset a layout variable?
 
 assign ($spec, $value=null)
 Assign one or more layout variables.
 
 render ($name=null)
 Render layout.
 

Static Public Member Functions

static startMvc ($options=null)
 Static method for initialization with MVC support.
 
static getMvcInstance ()
 Retrieve MVC instance of Zend_Layout object.
 
static resetMvcInstance ()
 Reset MVC instance.
 

Protected Member Functions

 _initMvc ()
 Initialize MVC integration.
 
 _initPlugin ()
 Initialize front controller plugin.
 
 _initHelper ()
 Initialize action helper.
 
 _initVarContainer ()
 Initialize placeholder container for layout vars.
 
 _setMvcEnabled ($mvcEnabled)
 Set MVC enabled flag.
 

Protected Attributes

 $_container
 
 $_contentKey = 'content'
 
 $_enabled = true
 
 $_helperClass = 'Zend_Layout_Controller_Action_Helper_Layout'
 
 $_inflector
 
 $_inflectorEnabled = true
 
 $_inflectorTarget = ':script.:suffix'
 
 $_layout = 'layout'
 
 $_viewScriptPath = null
 
 $_viewBasePath = null
 
 $_viewBasePrefix = 'Layout_View'
 
 $_mvcEnabled = true
 
 $_mvcSuccessfulActionOnly = true
 
 $_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'
 
 $_view
 
 $_viewSuffix = 'phtml'
 

Static Protected Attributes

static $_mvcInstance
 

Constructor & Destructor Documentation

__construct (   $options = null,
  $initMvc = false 
)

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.

Parameters
string | array | Zend_Config$options
Returns
void

Member Function Documentation

__get (   $key)

Get layout variable.

Parameters
string$key
Returns
mixed
__isset (   $key)

Is a layout variable set?

Parameters
string$key
Returns
bool
__set (   $key,
  $value 
)

Set layout variable.

Parameters
string$key
mixed$value
Returns
void
__unset (   $key)

Unset a layout variable?

Parameters
string$key
Returns
void
_initHelper ( )
protected

Initialize action helper.

Returns
void
_initMvc ( )
protected

Initialize MVC integration.

Returns
void
_initPlugin ( )
protected

Initialize front controller plugin.

Returns
void
_initVarContainer ( )
protected

Initialize placeholder container for layout vars.

Returns
Zend_View_Helper_Placeholder_Container
_setMvcEnabled (   $mvcEnabled)
protected

Set MVC enabled flag.

Parameters
bool$mvcEnabled
Returns
Zend_Layout
assign (   $spec,
  $value = null 
)

Assign one or more layout variables.

Parameters
mixed$specAssoc array or string key; if assoc array, sets each key as a layout variable
mixed$valueValue if $spec is a key
Returns
Zend_Layout
Exceptions
Zend_Layout_Exceptionif non-array/string value passed to $spec
disableInflector ( )

Disable inflector.

Returns
Zend_Layout
disableLayout ( )

Disable layout.

Returns
Zend_Layout
enableInflector ( )

Enable inflector.

Returns
Zend_Layout
enableLayout ( )

Enable layout.

Returns
Zend_Layout
getContentKey ( )

Retrieve content key.

Returns
string
getHelperClass ( )

Retrieve helper class.

Returns
string
getInflector ( )

Retrieve inflector.

Returns
Zend_Filter_Inflector
getInflectorTarget ( )

Retrieve inflector target.

Returns
string
getLayout ( )

Get current layout script.

Returns
string
getLayoutPath ( )

Get current layout script path.

Returns
string
getMvcEnabled ( )

Retrieve MVC enabled flag.

Returns
bool
static getMvcInstance ( )
static

Retrieve MVC instance of Zend_Layout object.

Returns
Zend_Layout|null
getMvcSuccessfulActionOnly ( )

Get MVC Successful Action Only Flag.

Returns
bool
getPluginClass ( )

Retrieve plugin class.

Returns
string
getView ( )

Get current view object.

If no view object currently set, retrieves it from the ViewRenderer.

Todo:
Set inflector from view renderer at same time
Returns
Zend_View_Interface
getViewBasePath ( )
getViewScriptPath ( )
getViewSuffix ( )

Retrieve layout view script suffix.

Returns
string
inflectorEnabled ( )

Return status of inflector enabled flag.

Returns
bool
isEnabled ( )

Is layout enabled?

Returns
bool
render (   $name = null)

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

Parameters
mixed$name
Returns
mixed
static resetMvcInstance ( )
static

Reset MVC instance.

Unregisters plugins and helpers, and destroys MVC layout instance.

Returns
void
setConfig ( Zend_Config  $config)

Set options from a config object.

Parameters
Zend_Config$config
Returns
Zend_Layout
setContentKey (   $contentKey)

Set content key.

Key in namespace container denoting default content

Parameters
string$contentKey
Returns
Zend_Layout
setHelperClass (   $helperClass)

Set helper class.

Parameters
string$helperClass
Returns
Zend_Layout
setInflector ( Zend_Filter_Inflector  $inflector)

Set inflector to use when resolving layout names.

Parameters
Zend_Filter_Inflector$inflector
Returns
Zend_Layout
setInflectorTarget (   $inflectorTarget)

Set inflector target.

Parameters
string$inflectorTarget
Returns
Zend_Layout
setLayout (   $name,
  $enabled = true 
)

Set layout script to use.

Note: enables layout by default, can be disabled

Parameters
string$name
boolean$enabled
Returns
Zend_Layout
setLayoutPath (   $path)

Set layout script path.

Parameters
string$path
Returns
Zend_Layout
setMvcSuccessfulActionOnly (   $successfulActionOnly)

Set MVC Successful Action Only flag.

Parameters
bool$successfulActionOnly
Returns
Zend_Layout
setOptions (   $options)

Set options en masse.

Parameters
array | Zend_Config$options
Returns
void
setPluginClass (   $pluginClass)

Set plugin class.

Parameters
string$pluginClass
Returns
Zend_Layout
setView ( Zend_View_Interface  $view)

Set view object.

Parameters
Zend_View_Interface$view
Returns
Zend_Layout
setViewBasePath (   $path,
  $prefix = 'Layout_View' 
)
setViewScriptPath (   $path)
setViewSuffix (   $viewSuffix)

Set layout view script suffix.

Parameters
string$viewSuffix
Returns
Zend_Layout
static startMvc (   $options = null)
static

Static method for initialization with MVC support.

Parameters
string | array | Zend_Config$options
Returns
Zend_Layout

Member Data Documentation

$_container
protected
$_contentKey = 'content'
protected
$_enabled = true
protected
$_helperClass = 'Zend_Layout_Controller_Action_Helper_Layout'
protected
$_inflector
protected
$_inflectorEnabled = true
protected
$_inflectorTarget = ':script.:suffix'
protected
$_layout = 'layout'
protected
$_mvcEnabled = true
protected
$_mvcInstance
staticprotected
$_mvcSuccessfulActionOnly = true
protected
$_pluginClass = 'Zend_Layout_Controller_Plugin_Layout'
protected
$_view
protected
$_viewBasePath = null
protected
$_viewBasePrefix = 'Layout_View'
protected
$_viewScriptPath = null
protected
$_viewSuffix = 'phtml'
protected