On Feb 6, 2008 1:42 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> -- Philip G <[EMAIL PROTECTED]> wrote
> (on Wednesday, 06 February 2008, 01:19 PM -0600):
> > Forgive the back-to-back emails.
> >
> > I have a question about Zend_Layout's setup, well, a couple.
> >
> > First off, isn't it a bit odd to "start" the MVC from Zend_Layout? I
> > would think you would "startMVC" from your base loader file
> > (index.php) against the Zend_Controller_Front. I don't know. I just
> > think it feels odd to "startMVC" from the Layout class when by the
> > time the Layout is used, the MVC would have been started (controller
> > calls the layout).
>
> Well, technically it's not starting the MVC... it's starting
> *integration* with the MVC layer. But I, for one, felt that
> Zend_Layout::startMvcIntegration() was getting to be a bit much to type.
>

Okay, I can see it's starting the integration. I still don't see why
integration should be started at the View level (eg Layout level) and
not the Controller level.


> startMvc() does a few things:
>
>   * Instantiates the layout object and registers it in a static instance
>   * Instantiates and registers the Layout plugin, to automate rendering
>     the layout script.
>   * Instantiates and registers the Layout action helper, to give layout
>     awareness to your action controllers
>

That's sounds like startLayout() since startMvc() implies starting the
controller and models.

I can see startMvc() fitting in perfectly well at the start, when you
dispatch(). Instead of calling dispatch() you called startMvc() and
the magic happens.

The also would allow you to separate the Zend_Controller from the
Zend_View (the initial directly ZFW went). startMvc() will integrate
everything where dispatch() will only dispatch the controllers.

Maybe it's just too late to do such a big change, now. But that's how
I imagine it playing out.


> > Second one being, how do I get Zend_Layout to auto-recognize a
> > "layout" directory? The problem I'm running into is when I specific
> > ->setLayoutPath('./layouts'); it doesn't properly prepend my full file
> > system path in front of that.
>
> Use
>
>     dirname(__FILE__) . '/layouts'
>
> instead of './layouts'; if you want to be real paranoid, use
> realpath(dirname(__FILE__)).
>
> This is not a bug of Zend_Layout, but rather a more general PHP issue
> regarding include_paths.

Unfortunately that doesn't work very well either. The app directory is
custom and can be anywhere on the file system. And I'm instantiating
Zend_Layout from within my Controller_Plugin class which is located
within its own directory structure (so overlapping dirname() calls
won't work).

Zend_View automatically adds the full path properly. Why can't
Zend_Layout do so as well? It seems rather odd. It can be something as
simple as if layout path doesn't start with '/', prepend the view or
model directory path.


-- 
Philip
[EMAIL PROTECTED]
http://www.gpcentre.net/

Reply via email to