php - Where do I put view scripts needed by view helpers (using Zend_View and the default directory layout)? -
i've got relatively complicated portion of application, editor access control lists. need reuse in few places, , i'd loadable ajax-y , such.
because need use often, i'd make zend_view_helper. that's simple -- put $view->sethelperpath(application_path . '/views/helpers', 'cas_view_helper');
in bootstrap view, , seems set regards loading view helper.
however, helper should output using view script. there standard location should put that?
usually, when helper need view script script placed inside partial. location of partial may vary depending on directory structure, standard is:
application[/modules/name]/views/scripts/partials/
you can write helper this:
class cas_view_helper_foo extends zend_view_helper_abstract { protected $partial = 'partials/foo.phtml'; protected $view = null; // render partial here public function foo($params) { $this->view->partial($this->partial, $params); } // specifying method zend_view inject view here public function setview(zend_view_interface $view) { $this->view = $view; } }
Comments
Post a Comment