public function getArticles($type) { $output = ''; $counter = 0; switch ($type) { case 'slider': $articles = $this->news_repository->getSlideNews(); break; case 'featured': $articles = $this->news_repository->getFeaturedNews(); break; case 'recent': $articles = $this->news_repository->getRecentNews(); break; case 'standby': $articles = $this->news_repository->getStandByNews(); break; } foreach ($articles as $article) { $counter++; $link = $article->Link ? $article->Link : ''; $headline = $article->Headline; if (empty($headline)) { continue; } $data = array('Id' => $article->Id, 'Rank' => $article->Rank, 'Link' => $link, 'Image' => $article->getImage(), 'Headline' => $article->Headline, 'Type' => $type); $output .= $article->renderWith('NewsAdminPage_article', $data); } return $output; }