View script integration
Zend_Controller_Action_Helper_ViewRenderer provides transparent view integration for action controllers. It allows you to create a view object once, and populate it throughout all actions. Several global options may be set:
The helper autoinitializes the action controller view preDispatch(). It determines the path to the class file, and then determines the view base directory from there. It also uses the module name as a class prefix for helpers and views such that if your module name is 'Search', it will set the helper class prefix to 'Search_View_Helper' and the filter class prefix to ; 'Search_View_Filter'.
Usage:
// In your bootstrap:
Zend_Controller_Action_HelperBroker::addHelper(new Zend_Controller_Action_Helper_ViewRenderer());
// In your action controller methods: $viewHelper = $this->_helper->getHelper('view');
// Don't use controller subdirectories $viewHelper->setNoController(true);
// Specify a different script to render: $this->_helper->viewRenderer('form');
uses | |
---|---|
package | Zend_Controller |
subpackage | Zend_Controller_Action_Helper |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Controller_Action_Helper_Abstract |
__clone() : void
__construct(\Zend_View_Interface $view= null
, array $options= array()
) : void
Optionally set view object and options.
\Zend_View_Interface
array
direct(string $action= null
, string $name= null
, boolean $noController= null
) : void
string
string
boolean
getActionController() : \Zend_Controller_Action
\Zend_Controller_Action
getFrontController() : \Zend_Controller_Front
\Zend_Controller_Front
getInflector() : \Zend_Filter_Inflector
\Zend_Filter_Inflector
getModule() : string
string
getModuleDirectory() : string
\Zend_Controller_Action_Exception |
---|
string
getName() : string
string
getNeverController() : boolean
boolean
getNeverRender() : boolean
boolean
getNoController() : boolean
boolean
getNoRender() : boolean
boolean
getRequest() : \Zend_Controller_Request_Abstract
\Zend_Controller_Request_Abstract
$requestgetResponse() : \Zend_Controller_Response_Abstract
\Zend_Controller_Response_Abstract
$responsegetResponseSegment() : string
string
getScriptAction() : string
string
getViewBasePathSpec() : string
string
getViewScript(string $action= null
, array $vars= array()
) : string
Uses values found in current request if no values passed in $vars.
If \$_noController is set, uses \$_viewScriptPathNoControllerSpec; otherwise, uses \$_viewScriptPathSpec.
string
array
string
getViewScriptPathNoControllerSpec() : string
string
getViewScriptPathSpec() : string
string
getViewSuffix() : string
string
init() : void
inherited_from | \Zend_Controller_Action_Helper_Abstract::init() |
---|
init() : void
initView(string $path= null
, string $prefix= null
, array $options= array()
) : void
$options may contain the following keys:
string
string
array
\Zend_Controller_Action_Exception |
---|
postDispatch() : void
Only autorenders if:
inherited_from | \Zend_Controller_Action_Helper_Abstract::postDispatch() |
---|
postDispatch() : void
preDispatch() : void
render(string $action= null
, string $name= null
, boolean $noController= null
) : void
Renders a view based on the view script path specifications.
string
string
boolean
renderBySpec(string $action= null
, array $vars= array()
, string $name= null
) : void
Pass an action, and one or more specification variables (view script suffix) to determine the view script path, and render that script.
string
array
string
renderScript(string $script, string $name = null
) : void
Sets the noRender flag to true when called.
string
string
setActionController(\Zend_Controller_Action $actionController = null
) : \Zend_Controller_ActionHelper_Abstract
\Zend_Controller_Action
\Zend_Controller_ActionHelper_Abstract
Provides a fluent interfacesetInflector(\Zend_Filter_Inflector $inflector, boolean $reference = false
) : \Zend_Controller_Action_Helper_ViewRenderer
\Zend_Filter_Inflector
boolean
Whether the moduleDir, target, and suffix should be set as references to ViewRenderer properties
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetNeverController(boolean $flag = true
) : \Zend_Controller_Action_Helper_ViewRenderer
boolean
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetNeverRender(boolean $flag = true
) : \Zend_Controller_Action_Helper_ViewRenderer
boolean
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetNoController(boolean $flag = true
) : \Zend_Controller_Action_Helper_ViewRenderer
boolean
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetNoRender(boolean $flag = true
) : \Zend_Controller_Action_Helper_ViewRenderer
boolean
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetRender(string $action= null
, string $name= null
, boolean $noController= null
) : \Zend_Controller_Action_Helper_ViewRenderer
string
View script to render
string
Response named segment to render to
boolean
Whether or not to render within a subdirectory named after the controller
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetResponseSegment(string $name) : \Zend_Controller_Action_Helper_ViewRenderer
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetScriptAction(string $name) : \Zend_Controller_Action_Helper_ViewRenderer
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetView(\Zend_View_Interface $view) : \Zend_Controller_Action_Helper_ViewRenderer
\Zend_View_Interface
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetViewBasePathSpec(string $path) : \Zend_Controller_Action_Helper_ViewRenderer
Specification can contain one or more of the following:
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetViewScriptPathNoControllerSpec(string $path) : \Zend_Controller_Action_Helper_ViewRenderer
Specification can contain one or more of the following:
:controller will likely be ignored in this variant.
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetViewScriptPathSpec(string $path) : \Zend_Controller_Action_Helper_ViewRenderer
Specification can contain one or more of the following:
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interfacesetViewSuffix(string $suffix) : \Zend_Controller_Action_Helper_ViewRenderer
string
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interface_generateDefaultPrefix() : string
string
_getBasePath() : string
string
_getModuleDir() : string
string
_setInflectorTarget(string $target) : void
string
_setModuleDir(string $dir) : void
string
_setOptions(array $options) : \Zend_Controller_Action_Helper_ViewRenderer
array
\Zend_Controller_Action_Helper_ViewRenderer
Provides a fluent interface_shouldRender() : boolean
boolean
_translateSpec(array $vars = array()
) : string
Allowed variables are:
array
string
$view : \Zend_View_Interface
$_actionController : \Zend_Controller_Action
null
$_delimiters : array
$_frontController : mixed
null
$_inflector : \Zend_Filter_Inflector
$_inflectorTarget : string
''
$_moduleDir : string
''
$_neverController : boolean
false
$_neverRender : boolean
false
$_noController : boolean
false
$_noRender : boolean
false
$_pathDelimiters : string | array
$_responseSegment : string
null
$_scriptAction : string
null
$_viewBasePathSpec : string
':moduleDir/views'
$_viewScriptPathNoControllerSpec : string
':action.:suffix'
$_viewScriptPathSpec : string
':controller/:action.:suffix'
$_viewSuffix : string
'phtml'