Still confused about this.
Suppose you would like a common view script directory to be available to the
whole application, such as
APPLICATION_PATH . /views/common
In my Bootstrap class' _initView(), I tried inserting a
$view->addScriptPath(APPLICATION_PATH.'/views/common');
Evidently, that does not work. When I try to run a controller action in the
browser I get an exception about the error handler not being able to locate
the error script. From within a controller, dumping the output of
$this->view->getScriptPaths() I find that the path you tried to add is not
added to anything, it's the only thing. I infer that by calling
addScriptPath() on my $view object so early in cycle, you defeat the routing
and ZF can't resolve your URL to a controller/action.
The same $this->view->addScriptPath(APPLICATION_PATH.'/views/common') inside
a controller init() or action method does the job. But I don't want to have
to do that in every controller. So what's the best-practice, DRY way to
accomplish this? Front controller plugin/preDispatch()?
Next question: after much trial and error, the only way I could make an
action method just render a non-default view, not puke, not render the
default view as well, and not make me do a
$this->_helper->viewRender->setNoRender(), was the following:
$this->_helper->viewRenderer->renderScript('test.phtml');
Is that the only way? Seems kind of verbose.
Thanks,
David
--
Demand health care for everyone:
http://mobilizeforhealthcare.org/
--
David Mintz
http://davidmintz.org/