template = $listElementTemplate; $this->repository = $repository; } /** * @param array $criteria * @param int $offset * @param int $limit * @return bool|string */ public function render(array $criteria, $offset = 0, $limit = 0) { if($this->renderedContent) return $this->renderedContent; $renderedString = ''; $collection = $this->repository->findByCriteria($criteria,$offset,$limit); foreach($collection as $listElement) { $this->model = $listElement; ob_start(); include_once($this->template->getPHTMLPath()); $renderedString .= ob_get_clean(); } $this->renderedContent = $renderedString; return $this->renderedContent; } }