2009年2月12日星期四

Re: [fw-mvc] Keeping Logic out of the view

i put those things in self written view helpers that explain their purpose
and
which are injected with the necessary model components that allow access to
the persistence layer that contains the requried information.

to be in your example:

<?php if($this->modelSpecialEvents()->hasEvents()): ?>
<?php foreach($this->modelSpecialEvents() AS $event): ?>
do print...
<?php endif; ?>
<?php endif; ?>

On Thu, 12 Feb 2009 16:42:37 +0100, Jason DeBord <jasdebord@gmail.com>
wrote:
> 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?
>
> Thanks in advance!
>
> Jason DEBORD
> Limoges, France

没有评论: