-- david pr <[EMAIL PROTECTED]> wrote
(on Thursday, 15 March 2007, 09:20 PM -0700):
> I am trying to use modules. It is "half" successful - my controllers are
> being found in the appropriate directory - my problem is I want to set the
> view script path to the appropriate module but the module name is only
> available after the front controller is "dispatched". I can see in
> /Zend/Controller/Front.php that the module is set when the following code is
> executed in function dispatch():-
>
> $router->route($request);
>
> But I can't see how I can set up the router before dispatching. I don't want
> to set up my view's script path in every controller. I would like to do it
> in the bootstrap file. I can't see how I can easily do this. Find below a
> snippet of my bootstrap file. Can someone help please?
>
> version 0.8.0
Grab the current SVN (or 0.9.0 when it's released) and use initView()
and/or render() in the action controllers. The default implementation of
initView() assumes the following directory structure
(application|module)/
controllers/
views/
scripts/
<controllername>/
<action>.phtml
(helpers)/
(filters)/
This means you can then assume that views are in ../views/scripts, in
relation to your controller.
You can simply call this in your action, then:
$view = $this->initView();
Or, if you don't need to assign any variables, call something like this:
$this->render();
and it will render <controllername>/<action>.phtml.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/