-- Eric Coleman <[EMAIL PROTECTED]> wrote
(on Saturday, 17 March 2007, 02:01 PM -0400):
> Didn't look at the code / docs, but is there a way to change the path
> a bit?
Several ways, actually:
* Reset the view script path manually. Calling initView() initializes
the $view property, so all you need to do is call:
$this-> view-> setScriptPath($path);
// or
$view = $this-> initView();
$view-> setScriptPath($path);
* Override the initView() method. Doing so, you could provide your own
logic to initialize the view object, including using a different
class implementing Zend_View_Interface.
* Instantiate your own view object and assign it to the $view
property (must be done prior to any calls to initView() or render()):
$this-> view = new Zend_View();
$this-> view-> setScriptPath($path);
I tried to make the process as flexible as possible, to allow for
different template engines and the ability to modify the view
environment to suit individual needs; hopefully the above will help in
that regards.
> On Mar 17, 2007, at 10:58 AM, Matthew Weier O'Phinney wrote:
>
> > -- 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/