Hi Pat,

There seems to be two side to every debate. In this case the debate seems split 
between those who want a more powerful Zend_View that stands alone (incl. me 
;)), and those who are focusing on pushing more and more View tasks into the 
integration between View and Controller.

Case in point is Zend_Layout (or Xend_Layout). A significant piece of code for 
handling Layouts. Layouts are not rocket science. You decorate one template 
with another, end of story. Just as applying Tidy can be another form of 
decoration (just throw them in a stack and iterate). You don't need a 
Controller for performing simple View manipulation.

KISS is getting lost in the cracks somewhere...
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


----- Original Message ----
From: pat <[EMAIL PROTECTED]>
To: Zend Framework General <[email protected]>
Sent: Sunday, June 10, 2007 1:49:58 AM
Subject: [fw-general] An Alternative View





  To List,


 
   I’m not happy with the current View
implementation.  First I’ll layout my criticism,
then suggest
what I think may be an answer.  I realize
this won’t make it into the next release or anything like that but, I
would
like to know what people think about it

Basically, what I want is for the View to be more
like the
Controller.  I want it beefier, meatier,
able to stand on its own as part of the MVC. 
The MVC needs more V.  As things
stand now, the View has all but disappeared into the Controller’s
Action helper.  It needs to be brought out and
made a
powerful component in its own right.

The viewRenderer should be a plug-in for the View,
not the
other way around.  The viewRenderer
should be to the View, what the router is to the Front Controller.  People 
could then use a default viewRenderer
or slot in a custom viewRenderer, just as they now can change routers.

The View should be able to host plug-ins like the
Front Controller
does.  The plug-ins could have methods
like preRender, postRender to allow for such things as selecting skins
for the page
(preRender) or running the page through tidy (postRender).

The view should have helpers.  In
particular, there are two helper classes worth
considering.  View_Wrappers and View_Filters.   Wrappers add to, filters take 
away.   
 
Suppose you have a row from a database and you
only want the
1st, 3rd and 5th . You might write:

$info =  filter(array(‘1’,’3’,’5’),  $row);  

A wrapper might follow the decorator pattern and
do
something like this:

$list = wrap(‘list’,$array); 
// creates an html list out of an array



Wrappers can be chained together.

   There are lots of things to be puzzled
out, but the above is
the gist.

Implementation shouldn’t be too hard. 
Much of the design for plug-ins and such can
come from the Front Controller.   Instead
of extending the view class, a new
class named Zend_Alternative_View or something could be used.  This way you 
could use the old View while
proto-typing the new Zend_Alternative_View. 

So, what do you say? 
Could it be ready for Zend 2.0?  
 
Pat.







      
____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

Reply via email to