Ejemplo n.º 1
0
 public function prepare()
 {
     parent::prepare();
     $this->template = APP_VIEWS_ROOT . '/templates/pages/index.php';
     $newsModel = new News();
     $news = $newsModel->limit(5)->order('published', 'desc')->get();
     $this->setTemplateVariable('news_items', $news);
 }
Ejemplo n.º 2
0
 public function prepare()
 {
     parent::prepare();
     $this->template = APP_VIEWS_ROOT . '/templates/pages/news.php';
     $category = $this->category;
     $newsModel = new News();
     $news = $newsModel->limit(10)->get();
     if (is_null($category)) {
         throw new \Exception('Category was not set');
     }
     $this->setTemplateVariable('page_title', $category['title']);
     $this->setTemplateVariable('news_items', $news);
 }