Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

Zend_Layout Class Reference

Public Member Functions

 __construct ($options=null, $initMvc=false)
 setOptions ($options)
 setConfig (Zend_Config $config)
 setLayout ($name, $enabled=true)
 getLayout ()
 disableLayout ()
 enableLayout ()
 isEnabled ()
 setViewBasePath ($path, $prefix= 'Layout_View')
 getViewBasePath ()
 setViewScriptPath ($path)
 getViewScriptPath ()
 setLayoutPath ($path)
 getLayoutPath ()
 setContentKey ($contentKey)
 getContentKey ()
 getMvcEnabled ()
 setMvcSuccessfulActionOnly ($successfulActionOnly)
 getMvcSuccessfulActionOnly ()
 setView (Zend_View_Interface $view)
 getHelperClass ()
 setHelperClass ($helperClass)
 getPluginClass ()
 setPluginClass ($pluginClass)
 getView ()
 setViewSuffix ($viewSuffix)
 getViewSuffix ()
 getInflectorTarget ()
 setInflectorTarget ($inflectorTarget)
 setInflector (Zend_Filter_Inflector $inflector)
 getInflector ()
 enableInflector ()
 disableInflector ()
 inflectorEnabled ()
 __set ($key, $value)
 __get ($key)
 __isset ($key)
 __unset ($key)
 assign ($spec, $value=null)
 render ($name=null)

Static Public Member Functions

static startMvc ($options=null)
static getMvcInstance ()
static resetMvcInstance ()

Protected Member Functions

 _initMvc ()
 _initPlugin ()
 _initHelper ()
 _initVarContainer ()
 _setMvcEnabled ($mvcEnabled)

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

Detailed Description

Definition at line 30 of file Layout.php.


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

Definition at line 142 of file Layout.php.


Member Function Documentation

__get ( key )

Get layout variable

Parameters:
string$key
Returns:
mixed

Definition at line 701 of file Layout.php.

__isset ( key )

Is a layout variable set?

Parameters:
string$key
Returns:
bool

Definition at line 716 of file Layout.php.

__set ( key,
value 
)

Set layout variable

Parameters:
string$key
mixed$value
Returns:
void

Definition at line 690 of file Layout.php.

__unset ( key )

Unset a layout variable?

Parameters:
string$key
Returns:
void

Definition at line 727 of file Layout.php.

_initHelper (  ) [protected]

Initialize action helper

Returns:
void

Definition at line 286 of file Layout.php.

_initMvc (  ) [protected]

Initialize MVC integration

Returns:
void

Definition at line 252 of file Layout.php.

_initPlugin (  ) [protected]

Initialize front controller plugin

Returns:
void

Definition at line 263 of file Layout.php.

_initVarContainer (  ) [protected]

Initialize placeholder container for layout vars

Returns:
Zend_View_Helper_Placeholder_Container

Definition at line 316 of file Layout.php.

_setMvcEnabled ( mvcEnabled ) [protected]

Set MVC enabled flag

Parameters:
bool$mvcEnabled
Returns:
Zend_Layout

Definition at line 461 of file Layout.php.

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

Definition at line 743 of file Layout.php.

disableInflector (  )

Disable inflector

Returns:
Zend_Layout

Definition at line 667 of file Layout.php.

disableLayout (  )

Disable layout

Returns:
Zend_Layout

Definition at line 359 of file Layout.php.

enableInflector (  )

Enable inflector

Returns:
Zend_Layout

Definition at line 656 of file Layout.php.

enableLayout (  )

Enable layout

Returns:
Zend_Layout

Definition at line 370 of file Layout.php.

getContentKey (  )

Retrieve content key

Returns:
string

Definition at line 450 of file Layout.php.

getHelperClass (  )

Retrieve helper class

Returns:
string

Definition at line 516 of file Layout.php.

getInflector (  )

Retrieve inflector

Returns:
Zend_Filter_Inflector

Definition at line 637 of file Layout.php.

getInflectorTarget (  )

Retrieve inflector target

Returns:
string

Definition at line 603 of file Layout.php.

getLayout (  )

Get current layout script

Returns:
string

Definition at line 349 of file Layout.php.

getLayoutPath (  )

Get current layout script path

Returns:
string

Definition at line 426 of file Layout.php.

getMvcEnabled (  )

Retrieve MVC enabled flag

Returns:
bool

Definition at line 472 of file Layout.php.

static getMvcInstance (  ) [static]

Retrieve MVC instance of Zend_Layout object

Returns:
Zend_Layout|null

Definition at line 193 of file Layout.php.

getMvcSuccessfulActionOnly (  )

Get MVC Successful Action Only Flag

Returns:
bool

Definition at line 494 of file Layout.php.

getPluginClass (  )

Retrieve plugin class

Returns:
string

Definition at line 538 of file Layout.php.

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

Definition at line 563 of file Layout.php.

getViewSuffix (  )

Retrieve layout view script suffix

Returns:
string

Definition at line 593 of file Layout.php.

inflectorEnabled (  )

Return status of inflector enabled flag

Returns:
bool

Definition at line 678 of file Layout.php.

isEnabled (  )

Is layout enabled?

Returns:
bool

Definition at line 381 of file Layout.php.

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

Definition at line 773 of file Layout.php.

static resetMvcInstance (  ) [static]

Reset MVC instance

Unregisters plugins and helpers, and destroys MVC layout instance.

Returns:
void

Definition at line 205 of file Layout.php.

setConfig ( Zend_Config config )

Set options from a config object

Parameters:
Zend_Config$config
Returns:
Zend_Layout

Definition at line 305 of file Layout.php.

setContentKey ( contentKey )

Set content key

Key in namespace container denoting default content

Parameters:
string$contentKey
Returns:
Zend_Layout

Definition at line 439 of file Layout.php.

setHelperClass ( helperClass )

Set helper class

Parameters:
string$helperClass
Returns:
Zend_Layout

Definition at line 527 of file Layout.php.

setInflector ( Zend_Filter_Inflector $  inflector )

Set inflector to use when resolving layout names

Parameters:
Zend_Filter_Inflector$inflector
Returns:
Zend_Layout

Definition at line 626 of file Layout.php.

setInflectorTarget ( inflectorTarget )

Set inflector target

Parameters:
string$inflectorTarget
Returns:
Zend_Layout

Definition at line 614 of file Layout.php.

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

Definition at line 335 of file Layout.php.

setLayoutPath ( path )

Set layout script path

Parameters:
string$path
Returns:
Zend_Layout

Definition at line 416 of file Layout.php.

setMvcSuccessfulActionOnly ( successfulActionOnly )

Set MVC Successful Action Only flag

Parameters:
bool$successfulActionOnly
Returns:
Zend_Layout

Definition at line 483 of file Layout.php.

setOptions ( options )

Set options en masse

Parameters:
array | Zend_Config$options
Returns:
void

Definition at line 230 of file Layout.php.

setPluginClass ( pluginClass )

Set plugin class

Parameters:
string$pluginClass
Returns:
Zend_Layout

Definition at line 549 of file Layout.php.

setView ( Zend_View_Interface view )

Set view object

Parameters:
Zend_View_Interface$view
Returns:
Zend_Layout

Definition at line 505 of file Layout.php.

setViewSuffix ( viewSuffix )

Set layout view script suffix

Parameters:
string$viewSuffix
Returns:
Zend_Layout

Definition at line 582 of file Layout.php.

static startMvc ( options = null ) [static]

Static method for initialization with MVC support

Parameters:
string | array | Zend_Config$options
Returns:
Zend_Layout

Definition at line 173 of file Layout.php.


The documentation for this class was generated from the following file: