Mike Tramontano
eFashion Solutions - Backend Developer
mtramontano@efashionsolutions.com
-----Original Message-----
From: Matthew Weier O'Phinney [mailto:matthew@zend.com]
Sent: Tuesday, January 27, 2009 2:23 PM
To: fw-mvc@lists.zend.com
Subject: Re: [fw-mvc] Action view helper question
-- Ed Lazor <edlazor@internetarchitects.biz> wrote
(on Tuesday, 27 January 2009, 10:41 AM -0800):
> Which is better?
>
> Option #1
> Using the action method to collect data and pass (push?) it to the
> view through variables
>
> Option #2
> Using action view helpers within views to retrieve (pull?) data for display
>
>
> I've always read that the controller is supposed to prepare everything
> for the view. Option #2 seems like a cleaner approach though, so I'm
> wondering what you think.
Option #2 is a lot of overhead, and terrible from a performance
standpoint.
The point of the Controller in the first place is to manage the
environment, and determine what models and views need to be
instantiated. Typically you will push results of queries to your model
into your view, or simply push your model into the view; the view then
determines what to display, and how to display it. When seen from this
view point, using the action() view helper seems like an indirection --
it's treating actions as if they were models.
So, short answer, use Option #1.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论