View Single Post
  #5 (permalink)  
Old 04-25-2008, 03:02 PM
Elemental's Avatar
Elemental Elemental is offline
Senior Member
 
Join Date: Jul 2007
Posts: 122
Default

I have a view helper that contain several misc functions. I use it to store these types of one off methods that my view needs but doesn't really require a full seperate object. I really only do it this way for lack of a better idea.

Generally speaking tho, if your view is in need of a single function that won't be used anywhere else, you should examine your design. There is most likely a better way to handle it.

My "understanding" or "methodology" for using the ZF MVC is like this. The controller should take care of getting all the data the view needs from the model and having it formatted correctly (some would argue that formatting belongs in the view, what I mean here is does the data need to be in object, array, JSON, etc. formats). The model handles all the business logic for your data to ensure it's sanitary and accurate. The view simply displays the data. There are some nifty view scope logic tricks that can be applied and they should become view helpers. The view should not act upon the data, except to make it look it right and decide how to display it.

That's my 2 cents anyway...
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk
Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth
Reply With Quote