ZF2 use database table model in view helper
问题 To show an database count in my layout.phtml I want to use the view helper to render ths count (set in an db field). How do I use my database model in a view helper? Helper: namespace Application\View\Helper; use Zend\View\Helper\AbstractHelper; class CountHelper extends AbstractHelper { protected $count; public function __invoke() { return $this->count(); } public function setTableCount($sm, $myCountTable) { $this->count = $sm->get($myCountTable)->getCount(); return $this->count; } } Module