Hi Matthew,

Yep, my idea of partials is almost identical - same thing I proposed. I suppose 
the main feedback is whether I went overboard using a Zend_View_Factory (think 
of it as a ViewRenderer wannabe) where partials cross the Modules divide.

P
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


----- Original Message ----
From: Matthew Weier O'Phinney <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, June 25, 2007 10:51:03 PM
Subject: Re: [fw-general] Two-Step View, subclassing controller, etc

-- Pádraic Brady <[EMAIL PROTECTED]> wrote
(on Monday, 25 June 2007, 02:39 PM -0700):
> I haven't seen Ralph's implementation beyond the original Layout code he 
> posted
> a while back, but my argument against a Zend_Layout at the time remains the
> same - the Controller manages workflow and is unsuitable for managing
> presentation issues like Layout. The simple reason being that the Controller
> will use and depend on significantly more classes, require extra controller
> actions to be written by the user, and therefore require additional processing
> - and it all needs a ton of code. It's akin to using a sledgehammer to stick a
> thumb tack into something. 

It really depends on your needs. If you're accessing a ton of different
models, and mostly to read from them, yes, it's probably overkill. I'm
typically only forwarding once, maybe twice (if at all), and thus it's
not a big overhead.

> Other languages have consistently abandoned or advised careful use of
> similar constructs in the past. My own Layout implementation is
> scarcely a screen full of code - a simple decorator effect.
> 
> I think I called this the framework's "Controller obsession" in my original
> response...;). Few people in PHP seem to apply the View Helper pattern (Views
> using a read only Model API to read from the Model without Controller
> dependecies). 

I actually use both forwarding and view helpers in my applications. View
helpers when I want to read from a model, forwarding when I need to
do something more (typically only when doing something like auth).

My idea of layout is, as I've said before, a two-step view, and I don't
need to forward at all for that -- just use a plugin.

> The pattern is pretty standard outside PHP. That said, my proposal has
> a requirement not to prevent Controller based solutions. I hadn't
> realised Ralph has started implementing the same functionality as
> Partials and such though :). They all require changes at the View
> level (partials are a simple rendering mechanic) which one assumes is
> out of Zend_Layout's scope...

Partials have been on my to-do list for a while now. They actually don't
require any changes on the view level; you can very simply create a new
View object in the helper, setup the environment from the old view
object (minus the variables), assign variables as passed, and then
render the "partial" view. I just need to write good test cases for
them, and determine the syntax for pulling them.

> The alternate approach be comin' :).

Keep it coming! Choice is good!

> ----- Original Message ----
> From: Martin Carpentier <[EMAIL PROTECTED]>
> To: Ralph Schindler <[EMAIL PROTECTED]>
> Cc: [email protected]
> Sent: Monday, June 25, 2007 6:40:23 PM
> Subject: Re: [fw-general] Two-Step View, subclassing controller, etc
> 
> Hi Ralph,
> 
> It looks like a very interesting approach to solve that problem. Is it on the
> wiki yet cause I can't seem to find it.
> 
> Also, I was wondering if it was the same kind of solution as the one proposed
> by P draic Brady or if it was a different solution to the same problem ?
> 
> Thanks,
> 
> Martin
> 
> On 6/21/07, Ralph Schindler <[EMAIL PROTECTED]> wrote:
> > I have a component proposal (writing it as we speak) for Zend_Layout.  A
> > full working implementation can be found at
> >
> > http://svn.ralphschindler.com/repo/Xend/
> >
> > (executed in the Xend_Layout namespace) minimal docs and usage is in the
> > docs folder..  Several people on #zftalk have had a chance to implement
> > this solution with great ease.
> >
> > I will post back when the proposal is updated on the wiki.
> >
> > More to come,
> > -ralph
> >
> > Extract from pending proposal:
> >
> > Zend_Layout attempts to solve a problem that, since rearing its ugly
> > head over and over, has gone by many names: Composite Views, Layouts,
> > Templates, Partial Views, and/or Complex Views.  They all basically
> > attempt to describe a common problem - that of being able to maintain a
> > consistent look and feel throughout a site or web application while
> > maintaining the "Don't Repeat Yourself" principals.
> >
> > Zend_Layout addresses the problem with a common pattern, the
> > two-step-view pattern
> > ( http://www.martinfowler.com/eaaCatalog/twoStepView.html). The Two Step
> > View pattern breaks the process up into two distinct stages.  The
> > primary stage allows the user requested action as well as layout
> > requested actions to dispatch and execute their respective views saving
> > them to the controllers response object.  The second stage of the
> > process takes the already dispatched actions responses and directs them
> > to the layout where final placement of content is made (in a Layout
> > specific view) before being sent back to the user.
> >
> > Zend_Layout requires no changes to the existing codebase to accomplish
> > its job.  To maintain controller over the dispatch process, Zend_Layout
> > attaches a controller plugin - this is the essense of the Two-Step-View
> > and common way to implement the 2SV as we have seen already.
> > Zend_Layout also registers its own action helper (named LayoutManager),
> > so that the developer can directly interact with Zend_Layout from within
> > their actions.
> >
> > David Mintz wrote:
> > >
> > > This newbie is liking the Two Step View where your plugin basically
> > > intercepts the response body and sticks it into a sitewide template at
> > > dispatchLoopShutdown() time.
> > >
> > > So: if you want all your controllers to use a common Zend_View object
> > > (so that the view vars they set will end up available to the sitewide,
> > > enclosing template), what approach would you recommend? In the name of
> > > DRY it seems you would might have your bootstrap put the new Zend_View()
> > > in the registry, and
> > >
> > > class MyAppController extends Zend_Controller_Action
> > >
> > > {
> > >     public function init() {
> > >
> > >         $this->view = Zend_Registry::get('view');
> > >     }
> > > }
> > >
> > > and then have your controllers extend MyAppController instead of
> > > Zend_Controller_Action. Thoughts?
> > >
> > > --
> > > David Mintz
> > > http://davidmintz.org/
> > >
> > > "Our universe is just one of those things that happens from time to time."
> >
> >
> 
> 
> 
> --
> Martin Carpentier
> 
> 
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Looking for a deal? Find great prices on flights and hotels with Yahoo!
> FareChase.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/







       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

Reply via email to