Hello people, check out this example found at :
http://framework.zend.com/manual/en/performance.view.html
class My_View_Helper_BugList extends Zend_View_Helper_Abstract
{
public function bugList()
{
$model = new Bug();
$html = "<ul>\n";
foreach ($model->fetchActive() as $bug) {
$html .= sprintf(
"<li><b>%s</b>: %s</li>\n",
$this->view->escape($bug->id),
$this->view->escape($bug->summary)
);
}
$html .= "</ul>\n";
return $html;
}
}
I like the approach to attach the Model inside view helper for
specific stuff and reusability. Im right now needing a helper exactly
like this but i dont know if i'm violating any pattern rule.
One guy as commented out about above example that this is a bad
practive since the view shouldn't know the model. What do you think
about this ? Should i go ahead in the same way?
I have read in many places that this is pretty acceptable in the MVC,
just wanted to confirm this.
Thanks,