Prev | Current Page 89 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

3 shows the SiteTemplate??™s dispatchLoopStartup() function.
Listing 3.3: SiteTemplate::dispatchLoopStartup()
public function dispatchLoopStartup(
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
Zend_Controller_Request_Abstract $request)
{
$viewRenderer = Zend_Controller_Action_HelperBroker:: \
getExistingHelper('viewRenderer');
if (is_null($viewRenderer->view)) {
$viewRenderer->init(); #1
}
$this->_view = $viewRenderer->view;
// add View/Helper directory to path
$prefix = 'Places_View_Helper'; #2
$dir = dirname(__FILE__) . '/../../View/Helper'; |#3
$this->_view->addHelperPath($dir, $prefix); |
}
(annotation) <#1 Ensure view is created by the view renderer>
(annotation) <#2 Set prefix for Places specific view helpers>
(annotation) <#3 Set up path to helper directory>
The dispatchLoopStartup() function initializes the view and adds an additional view helper directory to it.
By default the view created by the ViewRenderer sets up two directories for the view helpers:
Zend/View/Helpers and the local module??™s views/helpers. Most applications have view helpers that are used
across multiple modules and Places is no exception.


Pages:
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
pustaki szklane House Extension Kąty Rybackie noclegi kasyno Kołobrzeg