(on Thursday, 12 February 2009, 04:42 PM +0100):
> How do you keep logic out of the view when you are dealing with dynamic content
> that may not exist?
>
> For example:
>
> Special events are displayed on a webpage. If there are special events, we
> return an array to the page. However if there are no events scheduled we return
> false.
>
> If we return false to the view, we need to check for it there. Right?
There's nothing saying you can't have logic in the view! In fact, you
_should_ have logic in the view -- *DISPLAY* logic. This includes
checking conditions to determine what to display, looping over values to
build aggregate content, etc.
*BUSINESS* logic should be in your models. *DISPLAY* logic belongs in
your views.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论