Zend addScriptPath in postDispatch?

80 Views Asked by At

is it a good idea to add a script path in postDispatch of a controller? Or is the init() or preDispatch() function a better place for it?

public function postDispatch() {
   $this->view->addScriptPath( path/to/scripts );
}

In fact adding a script path in postDispatch does not work correctly.

So where I should put it - init() or preDispatch()?

1

There are 1 best solutions below

0
On BEST ANSWER

I would vote for init() in your case. As there is nothing changed in dispatching loop there is no sense using preDispatch. But it's going to work in both cases.

In my zf project we have modules so we have addScriptPath calls in module initialization files.